I am having trouble figuring out the code to connect to my SqlServer Db from my vb
.net code using a system DSN.
Currently, I have this code working:
Dim myConnect As New SqlConnection("Data Source=NOTEBOOK_DEV1;Initial Catalog=3D;Integrated Security=True")
Dim myQuery As String = "Select U_RptSelLbl,U_RptSelName,U_RptSelTyp from [@LBSIRSEL] where U_RptMenuID = '" & g_MenuID & "'"
Dim table As New DataTable
Dim userCol As New DataColumn("User Entry", GetType(String))
Dim adapter As New SqlDataAdapter(myQuery, myConnect)
I will be getting, passed in code, an ODBC System DSN, Database Name, Password, Userid.
So, I need to convert my logic to use the system DSN instead of NOTEBOOK_DEV1.
All the code I try to reference the DSN with does not work. Is this a feasible scenario? If so, can you help with what I may be missing?