Monday 19 August 2013

The user instance login flag is not supported on this version of SQL Server. The connection will be closed.

Server Error in '/MyWebsite' Application.

The user instance login flag is not supported on this version of SQL Server. The connection will be closed.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: System.Data.SqlClient.SqlException: The user instance login flag is not supported on this version of SQL Server. The connection will be closed.

Source Error:


Line 15:     {
Line 16: SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");
Line 17: con.Open();
Line 18: SqlCommand cmd = new SqlCommand("select COUNT(*)FROM regform WHERE username='" + TextBox1.Text + "' and password='" + TextBox2.Text + "'");
Line 19: cmd.Connection = con;

Source File: c:\Documents and Settings\Vamsi\My Documents\Downloads\WebSite10\login.aspx.cs    Line: 17 



Solution:-

              Check The SqlConnection Object's String Is Given Correct Or Not. 
I Had Given SqlConnection con = new SqlConnection(@"Data Source=.\;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");  Where I Did Not Mentioned DataSource Name As .\SQLExpress . So The Error Occured.
It Should Be As Below:
SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=|DataDirectory|\Database.mdf;Integrated Security=True;User Instance=True;");

No comments:

Post a Comment

Note: only a member of this blog may post a comment.