Question about automatic connection string settings using VS2005

G

Guest

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
adapter, whenever one is instantiated?
 
W

William \(Bill\) Vaughn

I would leverage the settings value created by the Data Source config wizard.

Dim cn As New SqlClient.SqlConnection

cn.ConnectionString = My.Settings.CustomerConnectionString

hth
--
____________________________________
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)
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top