private void btn_login_Click(object sender, EventArgs e)//登录按钮 { tb_UserInfo User = new tb_UserInfo(); User.Lname1 = txtuser.Text.ToString().Trim(); User.Lpass1 = txtpass.Text.ToString().Trim(); if (txtuser.Text == "" || txtpass.Text == "") { MessageBox.Show("用户名或密码不能为空!"); if (txtuser.Text == "") { txtuser.Focus(); } else if (txtpass.Text == "") { txtpass.Focus(); } return; } else if (txtyzm.Text == "") { MessageBox.Show("验证码不能为空"); txtyzm.Focus(); return; } else if (txtyzm.Text != label4.Text) { MessageBox.Show("验证码输入有误"); txtyzm.Focus(); txtyzm.Clear(); label4.Text = YanZM(); return; } // string sql = "select * from Wm_Login where Lname=@userId and Lpass=@userpassword"; //DataRow row = Methods.GetRow(sql, new SqlParameter("@userId", txtuser.Text), new SqlParameter("@userpassword", txtpass.Text)); int flag = SQLOperation.ExistCount(User); if (flag > 0) { // MessageBox.Show("登录成功!\t"+flag.ToString()); Parameter_Query.username = this.txtuser.Text; Parameter_Query.userflag = flag; PassEdit.passs = this.txtpass.Text; Parameter_Query PQ = new Parameter_Query(); PQ.Show(); this.Hide(); return; } else { MessageBox.Show("不存在此用户!请重新登录!"); txtuser.Text = ""; txtpass.Text = ""; txtyzm.Text = ""; label4.Text = this.YanZM(); txtuser.Focus(); return; } }
private void button2_Click(object sender, EventArgs e) { this.Hide(); Parameter_Query.username = name; Parameter_Query.userflag = flag; Parameter_Query pq = new Parameter_Query(); pq.Show(); }