VS 2005 Connection String Problems

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I created datasets and tableadapters using drag and drop and am using a mdb
that is included in the project for development of a C# application.
However, the release version of the software must be able to point to
different datasource locations.

There must be an economical way to do this, however I have not been able to
determine the correct procedure.

Is there a way to do this?

Thanks,

Duane
 
Hello Cor,

Thanks for your reply. I have reviewed the articals but they refer to
design time solutions. I need a dynamic runtime solution.

Thanks,

Duane
 
Duane,

I never have worked until now with tableadapters, but they are just
inheriting dataadapter.

Therefore I assume that you before every use of it. (the first fill) can set
this to the needed one.

XXXXXTableAdapter.Connection.ConnectionString = myconnectionstring
http://www.connectionstrings.com/

(The type of connection should of course be the same)

I hope this helps,

Cor
 
I have same prblem, my resolution is:

Go to YourDataset.Designer.cs and add a setter for connectionstring (onyl
getter is generated by VS)

set
{
this["MyConnectionString"] = value;
}

Then set connectionstring from application:
Properties.Settings.Default.MyConnectionString = myConnStr;

Of course, bad thing is that every time you re create dataset, you have to
insert setter again
That's why i'm still looking for right solution for this one.
 
Back
Top