The following code is for creating a Server-side Recordset.
Option Explicit
Dim CN As Connection
Dim comobj As Command
Dim rs As Recordset
Private Sub Form_Load()
Set CN = New Connection
Set comobj = New Command
Set rs = New Recordset
rs.CursorType = adOpenStatic
rs.CursorLocation = adUseServer
With CN
.ConnectionString = “Integrated Security=SSPI;Initial Catalog=FinAccounting;Data Source=SYS1”
.Provider = “SQLOLEDB”
.Open
Option Explicit
Dim CN As Connection
Dim comobj As Command
Dim rs As Recordset
End With
With comobj
.ActiveConnection = CN
.CommandText = “SELECT * FROM AccountsTable”
End With
Set rs = comobj.Execute
End Sub
If we want to create the recordset on client side, we can use rs.CursorLocation = adUseClient.
Filed under: visual basic | Tagged: recordset

Globe of Blogs
