Click here to Skip to main content
15,913,084 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i created a login form but not able to connect the database.It shows the below error

Instance failure.
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.InvalidOperationException: Instance failure.

Source Error:


Line 27: cmd.Parameters.AddWithValue("@UserName", txtUserName.Text);
Line 28: cmd.Parameters.AddWithValue("@Password", txtPWD.Text);
Line 29: con.Open();
Line 30: SqlDataAdapter da = new SqlDataAdapter(cmd);
Line 31: DataTable dt = new DataTable();
Posted

Check your instance is working.
try to connect sql server with these steps
Database connectivity with Oracle,SQL Server and MS Access using Visual Studio

if it connected successfully then use same connection string careted after following given steps.
 
Share this answer
 
Line 29: con.Open();
Line 27: cmd.Parameters.AddWithValue("@UserName", txtUserName.Text);
Line 28: cmd.Parameters.AddWithValue("@Password", txtPWD.Text);
Line 30: SqlDataAdapter da = new SqlDataAdapter(cmd);
Line 31: DataTable dt = new DataTable();

Try this..You need to open connection firstly
 
Share this answer
 
Comments
vanarajranjit 27-Sep-13 1:28am    
How to do ?
indrajeet jadhav 27-Sep-13 1:29am    
I posted the code
..is that not working?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900