private void button1_Click(object sender, EventArgs e) { OleDbDataReader myReader; string sql = null; try { LocalConn = Common_DB.DBConnection(); LocalConn.Open(); if (txtID.Text == "" || txtPWD.Text == "") { MessageBox.Show("ID 또는 Password를 입력 하세요..."); return; } sql = "select pwd from member "; sql += " where id = " + "'" + txtID.Text + "'"; myReader = Common_DB.DataSelect(sql, LocalConn); if (myReader.Read()) { if (txtPWD.Text != myReader["pwd"].ToString()) { MessageBox.Show("Password가 맞지 않습니다..."); return; } } else { MessageBox.Show("등록되지 않은 ID 입니다."); return; } //----------- ID가 PWD가 맞는 경우 FrmMDIMain m = new FrmMDIMain(); m.Show(); //m.Owner = this; //--------------------------------- this.Hide(); Log.WriteLine("FrmLogin", "[로그인 :" + txtID.Text + "]"); } catch (Exception e1) { Log.WriteLine("FrmLogin", e1.ToString()); Log.WriteLine("FrmLogin", sql); MessageBox.Show("FrmLogin", "로그인 오류! " + sql); } }
private void btnLogin_Click(object sender, EventArgs e) { OleDbDataReader myReader; string sql = null; try { localConn = Common_DB.DBConnection(); localConn.Open(); if (txtID.Text == "" || txtPWD.Text == "") { MessageBox.Show("ID 또는 PWD를 입력하세요"); } sql = "select pwd from member"; sql += " where id=" + "'" + txtID.Text + "'"; myReader = Common_DB.DataSelect(sql, localConn); if (myReader.Read()) { if (txtPWD.Text != myReader["pwd"].ToString()) { MessageBox.Show("pwd가 맞지 않습니다"); return; } } else { MessageBox.Show("ID가 맞지 않습니다"); return; } FrmMDIMain m = new FrmMDIMain(); m.Show(); this.Hide(); Log.WriteLine("frmlogin", "[login :"******"]"); } catch (Exception e1) { Log.WriteLine("frmlogin", e1.ToString()); Log.WriteLine("frmlogin", sql); MessageBox.Show("frmlogin", "로그인 오류 : " + sql); } }