I have this connection string:
And my code snippet:Code:Dim cnnString as String = "Provider=SQLOLEDB;Data Source=myMachineName\SQLEXPRESS;" & _ "Initial Catalog=MyDatabase;" & _ "Integrated Security=SSPI;"
I keep getting this error:Code:Private Sub adodbQueryBtn_Click() On Error GoTo dbErrorLbl Set dbConn = New ADODB.Connection dbConn.Open cnnString Set adoRST = dbConn.Execute("SELECT * FROM MyTable;") dbErrorLbl: Debug.Print "------------------------------------------------" Debug.Print "ADODB conn error: " & Err.Number & ", " & Err.Description & ", " & Err.Source & ", " & Err.HelpContext & ", " & Err.HelpFile End Sub
What do I do wrong?Code:ADODB conn error: -2147467259, [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, Microsoft OLE DB Provider for ODBC Drivers, 1000440, C:\Program Files (x86)\Common Files\Microsoft Shared\VBA\VBA7.1\1033\VbLR6.chm


Reply With Quote
