asp.net 去重复验证

string sql = " SELECT COUNT(Mobile) mcount FROM dbo.Yuanboguoji_student WHERE  Mobile='" + txtMobile.Text.Trim() + "'";
DataSet ds = DbHelperSQL.Query(sql);
int mcount = Convert.ToInt32(ds.Tables[0].Rows[0][0]);
if (mcount > 0)
{
    this.ClientScript.RegisterStartupScript(this.GetType(), "", "<script>alert("" + "号码已经存在;" + "");location.reload();</script>");
    return;
}
原文地址:https://www.cnblogs.com/panqingqiang/p/4635593.html