I have this code now, but I'm not sure if this is it.
Dim MyConnObj As ADODB.Connection 'ADODB Connection Object Dim myRecSet As New ADODB.Recordset 'Recordset Object Dim sqlStr As String ' String variable to store sql command Set MyConnObj = New ADODB.Connection MyConnObj.ConnectionString = "Provider = MSDASQL;" & _ "Data Source=LocalServer;" & _ "Initial Catalog=sample;" & _ "Login ID=SERVANT;" & _ "Driver=SQL Server;" MyConnObj.Open Set myRecSet = New ADODB.Recordset sqlStr = "select * from Employee" myRecSet.Open sqlStr, MyConnObj, adOpenKeyset
What provider should be used? I am using MS SQL Server 2000. Some sites are using SQLOLEDB and others use MSDASQL. I'm so confused right now. What is data source? I only put there LocalServer since it is in System DSN of ODBC and I'm using local. In MS SQL Server - Console Root\Microsoft SQL Servers\SQL Server Group\(local)(Windows NT)
I created a sample database under it and a table called Employee.
Is that the correct connectionString?
I have run this code but i get this error.
Run-time error'-2147467259(80004005)':[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified