SqlConnection con = new SqlConnection(strConnString);
SqlCommand
cmdCount = new SqlCommand("select count(*) from customers where name='"
+ txtCustomername.Text + "'",
con);
con.Open();
int
count = (int)cmdCount.ExecuteScalar();
if
(count > 0)
{
lblMessage.Text = "Customer already exists";
lblMessage.Visible = true;
}
else
{
Insert
query
}
con.Close();
No comments:
Post a Comment