Reputation: 9043
I created a web site in Visual Studio 2012 that interacts with a SQL Server Express database table where the database was created beforehand with SQL Server 2008. I added the connection with the database to the site, and all of this worked fine.
Now I am doing exactly the same with a new website but now get the error message.
System.Data.SqlClient.SqlException (0x80131904): Login failed for user ''
The error happens as I am trying to make the connection and with my previous project everything was fine and still is, exactly the same connection string was used in both cases. From where does this exception come from all of a sudden?
try
{
connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=Employee,Integrated Security=True;";
using (conn = new SqlConnection(connectionString))
{
conn.Open();
.....
}
}
How can I resolve this?
Upvotes: 1
Views: 178
Reputation: 263683
you have invalid connection string, you have used ,
instead of ;
connectionString = "Data Source=.\\SQLEXPRESS;Initial Catalog=Employee;Integrated Security=True;";
// ^ here
Upvotes: 4