验证新用户重复问题代码示例

protected bool SameName()
{
//验证新用户重名问题
SqlConnection con = DB.createDB();//Db公共类
string selectSql=”select*from tb_Users where userId’”+txtUserId.Text+””;
try{
con.Open();
SqlCommand cmd=new SqlCommand(selectSql,con);
object ob = cmd.ExecuteScalar();
//返回的是查询结果第一行第一列
if (ob!=null)
{
Response.Write(“”);
return true;
}
else
{
return false;

1
2
3
4
            }
}

finally

{
con.Close();
}


验证新用户重复问题代码示例
http://example.com/验证新用户重复问题代码示例.html
作者
John Doe
发布于
2021年3月25日
许可协议