问个问题
private bool UserValid()
{
SqlConnection conn = new SqlConnection((string)Application["sqlconnectionString"]);
conn.Open();
string sql="Select * from Register where UserName='"+ this.txtUserName.Text +"'";
SqlCommand cmd = new SqlCommand(sql,conn);
SqlDataReader reader = cmd.ExecuteNonQuery();
if(reader.Read())
{
return false;
}
else
{
return true;
}
}
SqlDataReader reader = cmd.ExecuteNonQuery(); 这句报错,说无法将类型int 隐式转换为system.data.sqlclient.sqldatareader
这怎么修改???