Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Public Function Test()
- ' connection and recordset variables
- Dim rstEmployees As ADODB.Recordset
- Dim Cnxn As ADODB.Connection
- Dim strSQLEmployees As String
- Dim strCnxn As String
- ' array variable
- Dim arrEmployees As Variant
- ' detail variables
- Dim strMessage As String
- Dim intRows As Integer
- Dim intRecord As Integer
- ' open connection
- Set Cnxn = New ADODB.Connection
- strCnxn = "Provider='sqloledb';Data Source='MySqlServer';" & _
- "Initial Catalog='Pubs';Integrated Security='SSPI';"
- Cnxn.Open strCnxn
- ' open recordset client-side to enable RecordCount
- Set rstEmployees = New ADODB.Recordset
- strSQLEmployees = "SELECT fName, lName, hire_date FROM Employee ORDER BY lName"
- rstEmployees.Open strSQLEmployees, Cnxn, adOpenStatic, adLockReadOnly, adCmdText
- /* elaborate recordset */
- rstEmployees.Close
- Cnxn.Close
- Set rstEmployees = Nothing
- Set Cnxn = Nothing
- End Test
Advertisement
Add Comment
Please, Sign In to add comment