private void diagram_button_Click(object sender, EventArgs e) { this.Hide(); diagramForm diagramform = new diagramForm(); diagramform.Show(); }
//로그인 버튼을 클릭 구현한 리스너 private void login_button_Click(object sender, EventArgs e) { SqlConnection con = new SqlConnection(@"Data Source=(LocalDB)\MSSQLLocalDB;AttachDbFilename=C:\Users\lujae\Documents\Database.mdf;Integrated Security=True;Connect Timeout=30"); SqlDataAdapter sda = new SqlDataAdapter("Select Count(*) USERNAME from USERINFO where USERNAME='******'and PASSWORD='******'", con); //결과처리 DataTable dataTable = new DataTable(); sda.Fill(dataTable); con.Close(); if (dataTable.Rows[0][0].ToString() == "1") { //로그인이 성공인 경우 this.Hide(); diagramForm diagramform = new diagramForm(); diagramform.Show(); } else { // 로그인이 실패 // 메세지 박스를 띄워줌 MessageBox.Show("아이디와 비밀번호를 확인해주세요."); } }