Friday, February 24, 2012

Connection string not valid !

I've build a website with asp.net and on my local machine it run very we. but when I store my website on a server, I have a error : ...error: 25 - Connection String not valid...

This is my connection string on my local machine : "add name="csIyp" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|iyapason.mdf;User Instance=true" providerName="System.Data.SqlClient" "

And the connection string on my webserver : "add name="csIyp" connectionString="data source= .\MSSQLSERVER;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|iyapason.mdf;User Instance=true" providerName="System.Data.SqlClient" "

So, what can I do to solve this probleme.

Thanks !

Does your web server have an actual SQL Server Express database engine installed, or SQL Server 2005 of some kind (as in, not Express). If the later, attaching DB on the fly like that string does might not work.|||There is a SQL Server 2005 engine installed on my webserver and i think that the instance name is "MSSQLSERVER". so can I have a sample connection string?|||

Hi siebobby,

Base on my understanding, we will not install SQL Server Express on the web server. So I think MSSQLSERVER is not an Express Edition. If my supposition is incorrect, please feel free to point out.

AttachDBFilename is used to specify the database to attach to the user instance. And User instances only work in the Express Edition of SQL Server 2005. So you must change the connect string for new SQL Server, the string may likes below:

connectionString="Data Source=.\MSSQLSERVER;Initial Catalog=iyapason;Integrated Security=True"

Be sure attaching iyapason.mdf in the MSSQLSERVER first.

No comments:

Post a Comment