Groups | Blog | Home
all groups > dotnet ado.net > july 2007 >

dotnet ado.net : Question about automatic connection string settings using VS2005


B. Chernick
7/11/2007 10:02:01 AM
I feel like I'm forgetting something. Assume Visual Studio 2005 (VB) and
assume you have created a data source and dataset by the usual means.
Assume multiple tables.

Now you have a designer.vb module associated with the dataset containing an
InitConnection sub for each table, as well as an ominous message at the top
of the file warning against manual change. (For simplicity's sake also
assume that you chose the option not to create an Application Setting
connection string.)

Given this, is there any one place in the dataset I could programmatically
set the connection string, or must I always do it for each individual table
William (Bill) Vaughn
7/11/2007 10:39:03 AM
I would leverage the settings value created by the Data Source config =
wizard.=20

Dim cn As New SqlClient.SqlConnection

cn.ConnectionString =3D My.Settings.CustomerConnectionString

hth
--=20
____________________________________
William (Bill) Vaughn
Author, Mentor, Consultant
Microsoft MVP
INETA Speaker
www.betav.com/blog/billva
www.betav.com
Please reply only to the newsgroup so that others can benefit.
This posting is provided "AS IS" with no warranties, and confers no =
rights.
__________________________________
Visit www.hitchhikerguides.net to get more information on my latest =
book:
Hitchhiker's Guide to Visual Studio and SQL Server (7th Edition)
and Hitchhiker's Guide to SQL Server 2005 Compact Edition (EBook)
-------------------------------------------------------------------------=
----------------------------------------------

[quoted text, click to view]
table=20
B. Chernick
7/11/2007 11:16:05 AM
No offense intended but that's the problem. All of the connection string
initialization is within the automatically generated dataset Designer.vb
module and there appears to be no way to change the initialization other than
by directly modifying the designer.vb code or by changing it through
individual data adapters whenever they're instantiated.

[quoted text, click to view]
AddThis Social Bookmark Button