SQL Server Express 2008 connection string
I am trying to configure my connection using SQL Server Express 2008.
Can anyone help me please. My server name is as follows: test\expressql2008
and my database is TestDatabase
My connectionstring is :
<add key="hibernate.connection.connection_string"
value="Server=localhost\EXPRESSQL2008;Database=TestMyproject;User=Me;Pwd=test;" />
It seems that the connections isn't wo开发者_高级运维rking and I get the error:
NHibernate.ADOException : cannot open connection
Here's all connectionstrings needed
http://connectionstrings.com/
<add name="SD_ConnectionString" connectionString="Data Source=[SQLEXPRESS NAME];Initial Catalog=TestDatabase;User ID=[USERNAME];Password=[PASSWORD]" providerName="System.Data.SqlClient"/>
string con = ConfigurationManager.ConnectionStrings["SD_ConnectionString"].ToString()
Can you provide more detail about this error there could be number of reasons
1- Please check ASP.NET user has access to your database if you are using trusted connection. 2- It could be better if you create a SQL USER and assign it permission of DBOWNER to your database and with your connection use that user information.
con = new SqlConnection(ConfigurationManager.ConnectionStrings["conn"].ConnectionString);
in web.config
精彩评论