Subject: Visual Studio 2005 DSN Connection
Posted By: mred2nice Post Date: 10/31/2006 10:30:54 AM
Good Morning

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))
    table.Columns.Add(userCol)
    Dim adapter As New SqlDataAdapter(myQuery, myConnect)
    adapter.Fill(table)

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?


Go to topic 51675

Return to index page 134
Return to index page 133
Return to index page 132
Return to index page 131
Return to index page 130
Return to index page 129
Return to index page 128
Return to index page 127
Return to index page 126
Return to index page 125