Private Sub Command1_Click()

‘Modified from Microsoft KB sample.
‘You need to have ADO 2.1 installed on your machine and set
reference to it first.

Dim Rst1 As New ADODB.Recordset
Dim Rst2 As New ADODB.Recordset

Rst1.Fields.Append “xx1″, adInteger
Rst1.Fields.Append “xx2″, adChar, 5
Rst1.Fields.Refresh

‘Add something to it. Have to open it first.
Rst1.Open
Rst1.AddNew
Rst1.Fields(0).Value = 1
Rst1.Fields(1).Value = “NAME1″
Rst1.Update

Kill “C:\Recordset.XML”

‘Persist data in Recordset to an XML file
Rst1.Save “c:\Recordset.xml”, adPersistXML
Rst1.Close
Set Rst1 = Nothing

‘Read XML file data into Recordset.
Rst2.Open “c:\Recordset.xml”
Do Until Rst2.EOF
Debug.Print Rst2(0), Rst2(1)
Rst2.MoveNext
Loop

Rst2.Close
Set Rst2 = Nothing

End Sub


Vota este artículo:
1 Estrella2 Estrellas3 Estrellas4 Estrellas5 Estrellas (No Ratings Yet)
Loading ... Loading ...

Posts anterior y posterior:


Posts Relacionados: