Many ways. A simple way is to just make your connection string:
Data Source= {0};Persist Security
Info=True;Integrated Security=False;User
ID=Username;Password=PW;Unicode=True
Then use
if (user1)
newConString = String.Format(myConString, serverLocation1);
else
newConString = String.Format(myConString, serverLocation2);
etc.
The {0} is a variable that String.Format() will replace. Look up
String.Format() in MSDN.
On Mon, Sep 28, 2009 at 3:09 PM, digger_54 <[email protected]>wrote:
>
> Hi,
>
> Need some help in VS2005 vb.net. I need to change my connection string
> to a different server depending on the location of a user, I have to
> code to get the users location.
>
> connectionString="Data Source= location1;Persist Security
> Info=True;Integrated Security=False;User
> ID=Username;Password=PW;Unicode=True"
>
> How can I change the ="Data Source= location1 part of it if the person
> belongs to location2?
>
> Thanks
>