string username = this.userName.Text.ToString();
SqlConnection con = DB.createConnection();
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from users where UserName='"+username+"',con");
int count = Convert.ToInt32(cmd.ExecuteScalar);
if (count > 0)
{
this.Button1.Text = "<script language=javascript><font color=red>该用户名已存在</font></script>";
}
错误:编译器错误信息: CS1502: 与“System.Convert.ToInt32(object)”最匹配的重载方法具有一些无效参数源错误:行 25: int count = Convert.ToInt32(cmd.ExecuteScalar);
SqlConnection con = DB.createConnection();
con.Open();
SqlCommand cmd = new SqlCommand("select count(*) from users where UserName='"+username+"',con");
int count = Convert.ToInt32(cmd.ExecuteScalar);
if (count > 0)
{
this.Button1.Text = "<script language=javascript><font color=red>该用户名已存在</font></script>";
}
错误:编译器错误信息: CS1502: 与“System.Convert.ToInt32(object)”最匹配的重载方法具有一些无效参数源错误:行 25: int count = Convert.ToInt32(cmd.ExecuteScalar);
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货