To do so:
You have to define connection and recordset objects.
Dim conn as New ADODB.Connection
Dim rs As New ADODB.Recordset
Then it follows the connection properties.
Private Sub Command0_Click()
Dim st as New ADODB.Stream, s As String
Set conn = New Connection
conn.Mode = adModeRead
conn.CursorLocation = adUseClient
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open CurrentProject.FullName
Set rs = New Recordset
Set rs.ActiveConnection = conn
rs.CursorType = adOpenStatic
rs.LockType = adLockOptimistic
rs.Open "Select * From Test1.mdb WHERE Table1 LIKE 'AL%", , , , adCmdText
We can also use DataGrid object to show the recordset content.
Set DataGrid1.DataSource = rs
This content will in Stream-Object written:
rs.Save st, adPersistXML
ReadText methode reads the content of this Stream in string variable.
s = st.ReadText
Text12.Value = s
rs.Save "c:\rs.xml", adPersistXML
End Sub
If you want to read from XML;
Private Sub Command1_Click()
On Error Resume Next
Set conn = New Connection
conn.Mode = adModeRead
conn.CursorLocation = adUseClient
conn.Provider = "Microsoft.Jet.OLEDB.4.0"
conn.Open CurrentProject.FullName
Set rs = New Recordset
Set rs.ActiveConnection = conn
rs.Open "c:\rs.xml", , , , adCmdFile
Set DataGrid1.DataSource = rs
End Sub