protected void Button2_Click(object sender, EventArgs e)
{
string connstr = System.Configuration.ConfigurationSettings.AppSettings["constr"];
SqlConnection myconnection = new SqlConnection(connstr);
myconnection.Open();
string Comstr = "select count(*) from ST_USERS where (ST_Name='" + TextBox1.Text + "')";
SqlCommand sqlcmd = new SqlCommand(Comstr, myconnection);
int n = (int)sqlcmd.ExecuteScalar();
if (n != 0)
{
Response.Write(" <script>alert('该用户名已被占用'); </script>");
} else
{
Response.Write(" <script>alert('可以使用'); </script>");
} myconnection.Close();
}
以上就是想实现那个检测用户是否已被占用的功能,可是运行后什么反应都没有,也没弹出相应的提示!
{
string connstr = System.Configuration.ConfigurationSettings.AppSettings["constr"];
SqlConnection myconnection = new SqlConnection(connstr);
myconnection.Open();
string Comstr = "select count(*) from ST_USERS where (ST_Name='" + TextBox1.Text + "')";
SqlCommand sqlcmd = new SqlCommand(Comstr, myconnection);
int n = (int)sqlcmd.ExecuteScalar();
if (n != 0)
{
Response.Write(" <script>alert('该用户名已被占用'); </script>");
} else
{
Response.Write(" <script>alert('可以使用'); </script>");
} myconnection.Close();
}
以上就是想实现那个检测用户是否已被占用的功能,可是运行后什么反应都没有,也没弹出相应的提示!
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货