//登陆用户 public bool user_land(SQL sq, 登陆界面 form, string txt_name, string txt_mima) { //SqlCommand cmd = new SqlCommand("select * from 用户 where 用户名='" + txt_name.Trim() + "' and 密码='" + txt_mima.Trim() + "'", sq.sql_ct); //SqlDataReader sdr = cmd.ExecuteReader(); string message; bool s = false; try { message = "select * from 用户 where 用户名='" + txt_name.Trim() + "' and 密码='" + txt_mima.Trim() + "'"; sdr = sq.sql_select_get(message); sdr.Read(); if (sdr.HasRows) { MessageBox.Show("登录成功!", "提示"); s = true; } else { MessageBox.Show("提示:用户名或密码错误!", "警告"); } sdr.Close(); } catch (Exception e) { MessageBox.Show(e.ToString()); } return(s); }
private void button2_Click(object sender, EventArgs e) { this.Close(); f.Close(); 登陆界面 g = new 登陆界面(); g.Show(); }