Assigning ConnectionString to DataAccessAdapter in Login

Posts   
 
    
pandu avatar
pandu
User
Posts: 86
Joined: 18-May-2006
# Posted on: 29-Nov-2006 06:58:39   

I have multiple databases with same set of tables and I need to assign ConnectiongString when the user login into the Application.

Let me explain the problem:

My application already have "Dim da as New DataAccessApapter" lines that works directly with "Main.ConnectionString"

I have created new connectionString at the time of login. But I am too lazy wink to change the line to "Dim da as New DataAccessAdapter(NewConnectionString) everywhere.

Is there any other way to apply the new ConnectionString to the DataAccessAdapter? simple_smile

Thanks.

Walaa avatar
Walaa
Support Team
Posts: 14950
Joined: 21-Aug-2005
# Posted on: 29-Nov-2006 07:11:59   

You can modify the generated code (DBSpecific->DataAccessAdapter.cs) Read the connection string and set it in the Constructor/initialization of the DataAccessAdater.

If yo don't want to modify the gen. code, drive a class from the DataAccessAdapter and have the initialization in the drived class, and then use your drived class instead of the DataAccessAdapter.