protected void CustomValidator1_ServerValidate(object source, ServerValidateEventArgs args)
{
string str = ConfigurationSettings.AppSettings["dm"];
SqlConnection conn = new SqlConnection(str);
conn.Open(); string strselect="select * from users where user_yonghu='"+TextBox1.Text+"'";
SqlCommand comm = new SqlCommand(strselect, conn);
SqlDataReader dr = comm.ExecuteReader();
if (dr.Read())
{
CustomValidator1.IsValid = false;
}
else
{
CustomValidator1.IsValid = true;
}
conn.Close();
}这段代码是什么意思?
{
string str = ConfigurationSettings.AppSettings["dm"];
SqlConnection conn = new SqlConnection(str);
conn.Open(); string strselect="select * from users where user_yonghu='"+TextBox1.Text+"'";
SqlCommand comm = new SqlCommand(strselect, conn);
SqlDataReader dr = comm.ExecuteReader();
if (dr.Read())
{
CustomValidator1.IsValid = false;
}
else
{
CustomValidator1.IsValid = true;
}
conn.Close();
}这段代码是什么意思?
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货