Guardar registro en formato XML (Visual Basic)
Visual Basic 13 agosto 2007
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:
Posts anterior y posterior:
Posts Relacionados:
- Previo: « Encontrar tablas en una BD (Visual Basic)
- Siguiente: Crea un formulario transparente (Visual Basic) »


Comentarios Recientes