I'm using ASP.NET with C# and SQL Server
T have to use my .mdf
file inside the App_Data folder because I don't have access to the SQL database.
T have a problem with this connection string only if T use .\SQLExpress
<connectionStrings>
<add name="msscEduConnectionString"
connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\MsscEdu.mdf;Integrated Security=True;"
providerName="System.Data.SqlClient"/>
</connectionStrings>
This connection string is not working and it shows error with attaching database
We have another site with connection string like this but different name and it works fine.
This is the connection string for the other site
<connectionStrings>
<add name="msdschoolkjConnectionString1" connectionString="Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\msdschoolkj.mdf;Integrated Security=True;User Instance=True"
providerName="System.Data.SqlClient" />
</connectionStrings>
If I use the following connection string it works only on my computer but not the server
<connectionStrings>
<add name="msscEduConnectionString"
connectionString="Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=|DataDirectory|\MsscEdu.mdf;Integrated Security=True"
providerName="System.Data.SqlClient"/>
</connectionStrings>
Can anyone assist?