Click here to Skip to main content
15,887,596 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am using Asp.net 4.0 In a website. I have added .mdf file to store some data of website the defined connection string is as
C#
<add name="ConStr" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|\Dasboard.mdf;User Instance=true" providerName="System.Data.SqlClient"/>


when I am deploying on the server then it is throwing an Error of sql connection but it is working fine at local.
Hence, what should I do to resolve that. Your assistance will be appreciable.
Posted
Updated 25-Sep-14 21:47pm
v2

1. your SQL Server name may be different, other than source=.\SQLEXPRESS,

check with your service provider.

2. display the error description of the exception, to find out what exactly happened, put your code in a try block, where you are making a connection.
 
Share this answer
 
I thing above database not attched in your server like local.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900