BennyLinton
Registered User.
- Local time
- Yesterday, 22:36
- Joined
- Feb 21, 2014
- Messages
- 263
I have a database that uses ODBC for most of its connection to SQL Server. I want to get away form this model. I have the basic code for the connection stored in a module:
And the basics for referencing and querying the database's tables, but I'm not sure how to set the datasource for the form to this code:
Option Compare Database
Public Const CONN_STRING As String = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=MHF;Data Source=NSQL01"
And the basics for referencing and querying the database's tables, but I'm not sure how to set the datasource for the form to this code:
Dim con As adodb.Connection
Dim cmd As adodb.Command
Dim rs As adodb.Recordset
Set con = New adodb.Connection
Set cmd = New adodb.Command
con.ConnectionString = CONN_STRING
con.Open
cmd.ActiveConnection = con
cmd.CommandType = adCmdText
cmd.CommandText = "Select a.peopleID from cashbatchdetail a where a.amount is null"
Set rs = cmd.Execute