private void logOutBtn_Click(object sender, EventArgs e) { this.Hide(); loginForm1 loginForm = new loginForm1(); loginForm.Show(); }
//private string connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDBFilename=|DataDirectory|UserData.mdf;Integrated Security = True;Connect Timeout=30"; private void RegisterBtn_Click(object sender, EventArgs e) { if (isIdOverlap()) { MessageBox.Show("이미 사용하고 있는 아이디 입니다."); Clear(); placeHolder(); } else if (joinTextBox_pw.Text != joinTextBox_pw2.Text) { MessageBox.Show("1차비밀번호와 2차비밀번호가 일치하지 않습니다."); } else if (joinTextBox_id.Text == "아이디를 입력하세요") //placeholder = " "; { MessageBox.Show("아이디를 입력해주세요"); } else if (joinTextBox_name.Text == "이름을 입력하세요") { MessageBox.Show("이름을 입력해주세요"); } else { try { SqlConnection sqlCon = new SqlConnection(connectionString); sqlCon.Open(); SqlCommand sqlCmd = new SqlCommand("UserAdd", sqlCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@UserId", joinTextBox_id.Text.Trim()); sqlCmd.Parameters.AddWithValue("@Password", joinTextBox_pw.Text.Trim()); sqlCmd.Parameters.AddWithValue("@UserName", joinTextBox_name.Text.Trim()); sqlCmd.ExecuteNonQuery(); MessageBox.Show("회원가입이 완료되었습니다."); this.Hide(); loginForm1 LoginForm = new loginForm1(); LoginForm.Show(); } catch (Exception ex) { MessageBox.Show($"error !! {ex.Message}"); } } }
private void editBtn_Click(object sender, EventArgs e) { string connectionString = @"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\chase\OneDrive\문서\UserData.mdf;Integrated Security=True;Connect Timeout=30"; if (editTextBox_pw.Text != editTextBox_pw2.Text) { MessageBox.Show("1차비밀번호와 2차비밀번호가 일치하지 않습니다."); } else if (editTextBox_id.Text != fixedId.Trim()) //placeholder = " "; { MessageBox.Show("아이디는 변경할 수 없습니다."); } else if (editTextBox_name.Text == "이름을 입력하세요") { MessageBox.Show("이름을 입력해주세요"); } else { try { SqlConnection sqlCon = new SqlConnection(connectionString); sqlCon.Open(); SqlCommand sqlCmd = new SqlCommand("UserUpdate", sqlCon); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.Parameters.AddWithValue("@UserId", editTextBox_id.Text.Trim()); sqlCmd.Parameters.AddWithValue("@Password", editTextBox_pw.Text.Trim()); sqlCmd.Parameters.AddWithValue("@UserName", editTextBox_name.Text.Trim()); sqlCmd.ExecuteNonQuery(); MessageBox.Show("정보수정이 완료되었습니다."); this.Hide(); loginForm1 LoginForm = new loginForm1(); LoginForm.Show(); } catch (Exception er) { MessageBox.Show($"error!! : {er.Message}"); } } }