HOME > .NET Framework > Forum > มันขึ้น error แบบนี้ทำยังไงดีค่ะ 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.
มันขึ้น error แบบนี้ทำยังไงดีค่ะ 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.
Server Error in '/esrithWeb_1' Application.
ExecuteScalar requires an open and available Connection. The connection's current state is 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.InvalidOperationException: ExecuteScalar requires an open and available Connection. The connection's current state is closed.
Source Error:
Line 27: strSQL = "SELECT COUNT(*) FROM Adminsystem WHERE username = '" + this.txtUsername.Text + "' AND [password] = '" + this.txtPassword.Text + "' ";
Line 28: objCmd = new SqlCommand(strSQL, objConn);
Line 29: intNumRows = Convert.ToInt32(objCmd.ExecuteScalar());
Line 30: if (intNumRows > 0)
Line 31: {