- mobile number already exists
Private bool
CheckMobNoExistOrNot(string MobileNo)
{
bool ReturnVal = false;
try
{
if (objCon.State != ConnectionState.Open)
ObjCon.Open();
using (SqlCommand cmd = new SqlCommand("select COUNT(*) from tablename where ContactNo=@MobNo ", ObjCon))
{
cmd.Parameters.AddWithValue("@MobNo", MobileNo);
object Obj = cmd.ExecuteScalar();
if (Obj != null)
{
if (Convert.ToInt32(Obj) > 0)
ReturnVal = true;
}
}
}
catch (Exception ex)
{
lblerrmsg.Text = "CheckMobNoExistOrNot" + ex.Message;
}
finally
{
if (ObjCon.State != ConnectionState.Closed)
ObjCon.Close();
}
return ReturnVal;
}
Comments
Post a Comment