string userID = " "; string userPassword = " "; int flag = 0; string type ; userID = txtEmployeeID.Text; userPassword = txtPassword.Text; txtEmployeeID.Text = ""; txtPassword.Text = ""; OleDbDataReader dr ; string strAccessConn = ConfigurationSettings.AppSettings["Constr"]; string strAccessSelect = "SELECT * FROM Login"; OleDbConnection myAccessConn = new OleDbConnection(strAccessConn); OleDbCommand myAccessCommand = new OleDbCommand(strAccessSelect,myAccessConn); try { try { myAccessConn.Open(); } catch(Exception ex) { MessageBox.Show("Error!", ex.Message); } dr = myAccessCommand.ExecuteReader(); while(dr.Read()) { if (dr["LID"].ToString().Equals(userID) ) { flag = 1; if( dr["LPASS"].ToString().Equals(userPassword)) { type = dr["LTYPE"].ToString(); switch(type) { case "内部人员": Form2 employeeForm = new Form2(); employeeForm.lId= userID; employeeForm.Show(); break; case "客户": Form3 customerForm =new Form3(); customerForm.lId= userID; customerForm.Show(); break; } } else MessageBox.Show("请输入正确用户密码", "无效密码",MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } } dr.Close(); myAccessConn.Close(); if (flag == 0) MessageBox.Show("请输入正确用户号码","无效用户号码",MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } catch (Exception ex) { MessageBox.Show("Error: Failed to retrieve the required data from the DataBase.\n{0}", ex.Message); return; }
- 粉丝: 0
- 资源: 2
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助