How to check textbox value is already exist or not with Entity Framework?
Can anybody help me.
Thanks a lot :-)
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Asp.Net HeinRank #6,010 · 279 reputationPosted May 7, 2015, 9:05 PM EDT
Dipankar BiswasRank #992 · 2K reputationPosted May 7, 2015, 8:12 PM EDT
try it..
public void EmailCheck()
{
string constring = ConfigurationManager.ConnectionStrings["ConnData"].ConnectionString;
SqlConnection con = new SqlConnection(constring);
SqlCommand cmd = new SqlCommand("Select * from EmailSignUp where EmailId= @EmailId", con);
cmd.Parameters.AddWithValue("@EmailId", this.txtEmail.Text);
con.Open();
SqlDataReader dr = cmd.ExecuteReader();
while (dr.Read())
{
if (dr.HasRows == true)
{
MessageBox.Show("EmailId = " + dr[5].ToString() + " Already exist");
txtEmail.Clear();
break;
}
}
}
thanks...