Wrox Programmer Forums
|
Visual Studio 2005 For discussing Visual Studio 2005. Please post code questions about a specific language (C#, VB, ASP.NET, etc) in the correct language forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Visual Studio 2005 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 31st, 2006, 11:58 AM
Registered User
 
Join Date: Oct 2006
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default DSN Connection

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?






Similar Threads
Thread Thread Starter Forum Replies Last Post
ODBC DSN connection atoyot BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 2 December 14th, 2006 06:40 PM
How make an automatic dsn less connection abhisheksud Classic ASP Databases 3 October 7th, 2005 04:51 AM
DSN Connection problem patwadd Classic ASP Basics 4 February 9th, 2005 04:26 AM
dsn-less connection problem Justine SQL Server ASP 3 March 8th, 2004 01:45 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.