Wednesday, 15 February 2012

c# - Need to change connection string every time -


I make a register, but every time I take a PC, I have to change the string connection.

This is my code:

Every time I am changing the computer, do not I have to change the data source? If someone can help me, then it will be good! Thanks for any help.

This is my connection string:

string connection = "" data source =. \ SQLEXPRESS; AttachDbFilename = C: \ Users \ Gal \ Desktop \ WebApplication2 \ WebApplication2 \ App_Data \ MyDB.mdf; Integrated security = true; User Instance = True ";

You | data directory | Placeholder should use:

  string connection = "" data source =. \ SQLEXPRESS; attachable debufflename = | data directory | \ MyDB .mdf; integrated security = true; user instance = true " ;   

.NET on your runtime with the path to your App_Data folder | DataDirectory | .

No comments:

Post a Comment