Server Error in '/' Application. Must declare the scalar variable "@uuu". 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: Must declare the scalar variable "@uuu". Source Error: Line 43: SqlCommand passcom = new SqlCommand(checkpasswordquery, adminlog); Line 44: cmd.Parameters.AddWithValue("@uuu", adminusernmetxtbx.Text); Line 45: string password = passcom.ExecuteScalar().ToString().Replace(" ", ""); Line 46: Line 47:
protected void Button1_Click(object sender, EventArgs e) { SqlConnection adminlog = new SqlConnection(sc); adminlog.Open(); string checkuser = "Select count(*) from UserInfo where UID=@uuu"; SqlCommand cmd = new SqlCommand(checkuser, adminlog); cmd.Parameters.AddWithValue("@uuu",adminusernmetxtbx.Text); int temp = Convert.ToInt32(cmd.ExecuteScalar().ToString()); adminlog.Close(); if (temp == 1) { adminlog.Open(); string checkpasswordquery = "Select count(*) from UserInfo where UID=@uuu"; SqlCommand passcom = new SqlCommand(checkpasswordquery, adminlog); cmd.Parameters.AddWithValue("@uuu", adminusernmetxtbx.Text); string password = passcom.ExecuteScalar().ToString().Replace(" ", ""); if (password == adminpasstxtbx.Text) { Session["UsrNme"] = adminusernmetxtbx.Text; Response.Redirect("BeravaAdmin.aspx"); } else { adminpasstxtbx.Text = "Password is incorrect"; } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)