16
Answers

How to deployment project database attachment other PC

Methoun Ahmed

Methoun Ahmed

7y
262
1
I have a project which is developer tools use in C# and Sqlserver 2012 and deployment that,s project make install file.But,i face a error connect to database sqlserver.Here is my connection string.Here is my connection string....
 
SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=D:\MESMANAGEMENT\MESMANAGEMENT\DATABASE\MESMANAGEMENT.MDF;Integrated Security=True"); 
Answers (16)
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Then mention with path. 
 
Note : The same path should be present in client place aslo. 
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Mdf
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Are you using sql server or mdf
?
 
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Same Error
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Just provide your database name
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Database Name or Database Location  ?
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Hi Methoun,
 
In configuration file, you have missed to mention your database name in initial catelog. PLease mention your database name there. 
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Here is config file
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Here insert screen shoot
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
HI Methoun,
 
Please add some screen shots 
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Now show the error
 
 
Additional information: Configuration system failed to initialize 
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
Change your sql connection code also,
 
App.config.cs
 
<configuration> <connectionStrings> <add name="Test" connectionString="Data Source=yourservername;Initial Catalog=yourdatabasename;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>
 
In reference Add - > System.configuration
 
In Page,
 
using system.configurations;
SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionString["Test"].toString());
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
Still now show thats error bro
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
HI Methoun,
 
What is your issue in that? 
0
Methoun Ahmed

Methoun Ahmed

NA 84 3.5k 7y
<configuration><connectionStrings><add name="Test" connectionString="Data Source=.;Initial Catalog=D:\MESMANAGEMENT\MESMANAGEMENT\DATABASE\MESMANAGEMENT.MDF;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>            ????????????
0
Ramesh Palanivel

Ramesh Palanivel

NA 9.5k 138.6k 7y
HI Methoun,
 
You just move your connection string in to app.config file.Once you move it and get the connection string from app.config. While you deploying your application in client environment, the app.config file will be editable. you change the server name in that.
Please refer app.config for connection string,
 
<configuration> <connectionStrings> <add name="Test" connectionString="Data Source=.;Initial Catalog=OmidPayamak;Integrated Security=True" providerName="System.Data.SqlClient" /> </connectionStrings> </configuration>