27,581
社区成员




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("用户名存在","信息");
}