-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmypage.cs
133 lines (98 loc) · 3.55 KB
/
mypage.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
using System;
using System.Windows.Forms;
using MySql.Data.MySqlClient;
namespace 로그인
{
public partial class mypage : Form
{
Form1 f1;
string myConnection = "datasource = localhost;port=3306;username=root;password=password";
public mypage()
{
InitializeComponent();
}
public mypage(Form1 frm2)
{
InitializeComponent();
this.f1 = frm2;
}
private void button_update_Click(object sender, EventArgs e)
{
string Query = "update login.edata set PW = '" + this.textBox_newPW.Text + "',nicname = '" + this.textBox_newNicname.Text + "',name ='" + this.textBox_newName.Text + "' where ID = '" + this.label_ID2.Text + "';";
MySqlConnection conDataBase = new MySqlConnection(myConnection);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
MySqlDataReader myReader;
try
{
conDataBase.Open();
myReader = cmdDataBase.ExecuteReader();
MessageBox.Show("수정되었습니다.");
this.Hide();
new MainForm(f1).Show();
while (myReader.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button_back_Click(object sender, EventArgs e)
{
this.Hide();
new MainForm(f1).Show();
}
private void label_ID2_Click(object sender, EventArgs e)
{
}
private void mypage_Load(object sender, EventArgs e)
{
MySqlConnection myConn = new MySqlConnection(myConnection); // mysql 연결 기능
//아이디 비밀번호 입력
MySqlCommand selectCommand = new MySqlCommand("select ID from login.edata where ID='" + f1.textBox_ID.Text + "'", myConn);
try
{
myConn.Open(); // mysql 연결
String Id = (String)selectCommand.ExecuteScalar();
label_ID2.Text = Id;
myConn.Close(); //mysql 연결해제
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
private void button_remove_Click(object sender, EventArgs e)
{
if (MessageBox.Show("회원탈퇴 하시겠습니까?", "회원탈퇴", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == DialogResult.Yes)
{
string Query = "delete from login.edata where ID='" + f1.textBox_ID.Text + "';";
MySqlConnection conDataBase = new MySqlConnection(myConnection);
MySqlCommand cmdDataBase = new MySqlCommand(Query, conDataBase);
MySqlDataReader myReader;
try
{
conDataBase.Open();
myReader = cmdDataBase.ExecuteReader();
MessageBox.Show("탈퇴했습니다.");
this.Hide();
new Form1().Show();
while (myReader.Read())
{
}
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
}
private void label4_Click(object sender, EventArgs e)
{
}
private void pictureBox7_Click(object sender, EventArgs e)
{
}
}
}