coding in cs file
protected void Submit_Click(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = ConfigurationManager.ConnectionStrings["sampleConnectionString2"].ToString();
SqlCommand cmd = new SqlCommand("update register set password='" + NPwd.Text+ "' where username = '" + UserId.Text + "' and password='" + Pwd.Text + "'");
try
{
con.Open();
cmd.ExecuteNonQuery();
Response.Write("<script language=Javascript>alert('Your Password Has Been Changed,Please Login With New Password')</script>");
Response.Redirect("~/Default.aspx");
}
catch (System.Data.SqlClient.SqlException exmsg)
{
string msg = "error occur while inserting";
msg += exmsg.Message;
throw new Exception(msg);
}
finally
{
con.Close();
}
it showing an error in executenonquery
sankarreddy