I have a VB.NET function that I want to connect to use to connect to a SQL Server database and return a recordset. I am new to VB and to SQL, so I hope it is something simple, but I am sure that my connection string and SQL query are correct, as they were checked by a teammate. I have a copy of the Exception message following the code
' Retrieve Record Set
Private Function GetRecords() As ADODB.Recordset
Dim conn As New ADODB.Connection
Dim rs As New ADODB.Recordset
With conn
.ConnectionString = "Server=12.345.678.9;Database=db01;User Id=userid01;Password=passwordyword"
.Open() ' Exception Thrown Here
rs.Open("SELECT * FROM [Table] ;", "sql")
rs.Close()
.Close()
End With
Return rs
End Function
Exception Message:
An exception of type 'System.Runtime.InteropServices.COMException' occurred in ThisProject.dll but was not handled in user code
Additional information: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
Any and all help would be greatly appreciated! Thanks!