如果用户有效与否如何传递标签,我正在使用带有应用程序设置的 3 层架构。所以你能指导我如何传递标签,无论用户是否有效
public static int login(string UserName, string Password)
{
SqlConnection con = new SqlConnection();
con.ConnectionString = GetConnectionString();
con.Open();
int userid = 0;
string selectstr = "select UserName,Password from Registration where UserName =' " + UserName + " ' And Password = ' " + Password + " ' ";
SqlCommand cmd = new SqlCommand();
cmd.CommandText = selectstr;
cmd.CommandType = System.Data.CommandType.Text;
cmd.Connection = con;
userid = cmd.ExecuteNonQuery();
cmd = null;
con.Close();
return userid;
if(......... ?)
{
labet.Text = " valid";
} else
{
label.Text = " not valid";