InsertUser.Parameters.AddWithValue("CustomerEmailID_vc",TextBox5.Text); for the parameter name.
Can you please tell if the CustomerName_vc is unique key or not in the table. and if not, there may be chance that your select query may return more than 1 and it bypasses your check
if(temp
==1) { Label1.Visible=true; //Label1.Text = "The Customer already existed..please enter another customer"; //Response.Redirect("AddCustomer.aspx",false); Response.Write("The Customer already existed..please enter another customer");
}
and so, u cannot check if the customer already exists or not. Just make sure you are checking with the unique key
Member
442 Points
158 Posts
Re: The data does not insert in database
May 16, 2012 02:08 AM|Ravi Kumar Kurasala|LINK
Place @ symbol in
InsertUser.Parameters.AddWithValue("CustomerEmailID_vc", TextBox5.Text); for the parameter name.
Can you please tell if the CustomerName_vc is unique key or not in the table. and if not, there may be chance that your select query may return more than 1 and it bypasses your check
if (temp == 1)
{
Label1.Visible = true;
//Label1.Text = "The Customer already existed..please enter another customer";
//Response.Redirect("AddCustomer.aspx",false);
Response.Write("The Customer already existed..please enter another customer");
}
and so, u cannot check if the customer already exists or not. Just make sure you are checking with the unique key