用戶登錄
代碼:
public static string uq ;\\設權限變量
public static string youhun;\\設帳號讀取變量
button如下
conn.Open();
stringstrSql = "Select * from long_yt where udzh ='" + youhuming.Text.ToString().Trim() + "'Andudata = '" + textBox2.Text.ToString().Trim() + "'";
SqlCommandcmd = new SqlCommand(strSql,conn);
SqlDataReaderdr = cmd.ExecuteReader();
if(dr.Read() == true)
{
youhun = dr["udzh"].ToString();
uq = dr["udste"].ToString();
status = true;
this.Dispose();
conn.Close();
}
else
{
MessageBox.Show("账号或密码错误!请确认后重新输入", "登录界面");
}
menuStrip1控件;
代碼如下:
string sqym = "select count(*) from longuser where uid='"+ LoginForm.youhun + "' and buan=";
int qx= Convert.ToInt32(LoginForm.uq);
private voidmain_Load(object sender, EventArgs e)
{ if (qx < 6)
{