27,579
社区成员
发帖
与我相关
我的任务
分享
bool exists = false;
using(SqlConnection conn =new SqlConnection( connstr )){
conn.Open();
string sql = "select uid from user where uid='" + userID +"'" ;
SqlCommand cmd = new SqlCommand("", conn);
exists = cmd.ExecuteSclar() != null;
}
if(exists){
MessageBox.Show("用户名存在","信息");
}