Wednesday, February 22, 2012

Attach MSSQL DB to SQL Developer Edition on runtime

If you have a program migrated to a pc where there is no sql express edition installed but a developer or enterprise edition is found and the database is part of the solution file.

If you run the program, a connection timeout error will occur. All you need to do is change the datasource name from .\sqlexpress to your Servername. Then change the credentials such as username and password.

Assuming you declare your connection string in app.config or web.config, here is an example:
1:  <add name="Southridge.Properties.Settings.SouthridgeConnectionString"  
2:        connectionString="Data Source=PC_SERVERNAME;  
3:        AttachDbFilename=|DataDirectory|\Southridge.mdf;user=sa;  
4:  password=yourpassword;  
5:        Connect Timeout=30;"  
6:        providerName="System.Data.SqlClient" />  

0 comments:

Post a Comment