View difference between Paste ID: r0xEjKWj and g975HB1r
SHOW: | | - or go back to the newest paste.
1
using System;
2
using System.Collections.Generic;
3
using System.ComponentModel;
4
using System.Data;
5
using System.Drawing;
6
using System.Linq;
7
using System.Text;
8
using System.Diagnostics;
9
using System.Windows.Forms;
10
using System.Drawing.Imaging;
11
using MySql.Data.MySqlClient;
12
13
namespace WindowsFormsApplication1
14
{
15
    public partial class Form1 : Form
16
    {
17
18
        public Form1()
19
        {
20
            InitializeComponent();
21
        }
22
        private void Form1_Load(object sender, EventArgs e)
23
        {
24
25
        }
26
27
        private void label1_Click(object sender, EventArgs e)
28
        {
29
30
        }
31
32
        private void toolStrip1_ItemClicked(object sender, ToolStripItemClickedEventArgs e)
33
        {
34
35
        }
36
37
        private void toolStripLabel1_Click(object sender, EventArgs e)
38
        {
39
40
        }
41
42
        private void splitContainer1_Panel2_Paint(object sender, PaintEventArgs e)
43
        {
44
45
        }
46
47
        private void splitContainer1_Panel1_Paint(object sender, PaintEventArgs e)
48
        {
49
50
        }
51
52
        private void tToolStripMenuItem_Click(object sender, EventArgs e)
53
        {
54
55
        }
56
57
        private void toolStripComboBox1_Click(object sender, EventArgs e)
58
        {
59
60
        }
61
62
        private void toolStripButton2_Click(object sender, EventArgs e)
63
        {
64
65
        }
66
67
        private void label3_Click(object sender, EventArgs e)
68
        {
69
70
        }
71
72
        private void toolStripStatusLabel1_Click(object sender, EventArgs e)
73
        {
74
75
        }
76
77
        private void textBox1_TextChanged(object sender, EventArgs e)
78
        {
79
80
        }
81
82
        private void richTextBox1_TextChanged(object sender, EventArgs e)
83
        {
84
85
        }
86
87
        private void pendingWarsToolStripMenuItem_Click_1(object sender, EventArgs e)
88
        {
89
90
        }
91
92
        private void contactU214ToolStripMenuItem_Click_1(object sender, EventArgs e)
93
        {
94
            Process.Start("http://www.xfire.com/profile/214hitmanblazed214/", null);
95
96
        }
97
        private void tabPage1_Click_1(object sender, EventArgs e)
98
        {
99
100
        }
101
102
        private void tabPage2_Click(object sender, EventArgs e)
103
        {
104
105
        }
106
107
        private void label1_Click_1(object sender, EventArgs e)
108
        {
109
110
        }
111
112
        private void listBox1_SelectedIndexChanged(object sender, EventArgs e)
113
        {
114
115
        }
116
117
        private void button1_Click_1(object sender, EventArgs e)
118
        {
119
            if (textBox1.Text.Trim() == "")
120
            {
121
                MessageBox.Show("ERROR: Seems Like You Forgot To Enter The Clan Name!");
122
                return;
123
            }
124
            if (textBox2.Text.Trim() == "")
125
            {
126
                MessageBox.Show("ERROR: Seems Like You Forgot To Enter The Date!");
127
                return;
128
            }
129
            if (textBox3.Text.Trim() == "")
130
            {
131
                MessageBox.Show("ERROR: Seems Like You Forgot To Enter The Match Type!");
132
                return;
133
            }
134
            if (richTextBox1.Text.Trim() == "")
135
            {
136
                MessageBox.Show("ERROR: Seems Like You Forgot To Enter The Rules!");
137
                return;
138
            }
139
140
            string connString = "Server=localhost;Database=request;Uid=root;Pwd=;";
141
            using (MySqlConnection mcon = new MySqlConnection(connString))
142
            using (MySqlCommand cmd = mcon.CreateCommand())
143
            {
144
                mcon.Open();
145
                cmd.CommandText = "SELECT * FROM requesttcw";
146
                using (MySqlDataReader reader = cmd.ExecuteReader())
147
                {
148
                    while (reader.Read())
149
                    {
150
                        Console.WriteLine(reader["ID"]);
151
                        Console.WriteLine(reader["ClanName"]);
152
                        Console.WriteLine(reader["Date"]);
153
                        Console.WriteLine(reader["Type"]);
154
                        Console.WriteLine(reader["Rules"]);
155
                    }
156
                }
157
            }
158
159
160
            using (MySqlConnection mcon = new MySqlConnection(connString))
161
            using (MySqlCommand cmd = mcon.CreateCommand())
162
            {
163
                mcon.Open();
164
                cmd.CommandText = "INSERT INTO requesttcw (ClanName, Date, Type, Rules) VALUES (@ClanName, @Date, @Type, @Rules)";
165
                cmd.Parameters.AddWithValue("@ClanName", textBox1.Text);
166
                cmd.Parameters.AddWithValue("@Date", textBox2.Text);
167
                cmd.Parameters.AddWithValue("@Type", textBox3.Text);
168
                cmd.Parameters.AddWithValue("@Rules", richTextBox1.Text);
169
                cmd.ExecuteNonQuery();
170
            } 
171
            textBox1.Clear();
172
            textBox2.Clear();
173
            textBox3.Clear();
174
            richTextBox1.Clear();
175
176
            MessageBox.Show("Your request has been successfully submitted!");
177
        }
178
179
        private void label6_Click(object sender, EventArgs e)
180
        {
181
182
        }
183
184
        private void label7_Click(object sender, EventArgs e)
185
        {
186
187
        }
188
189
        private void label9_Click(object sender, EventArgs e)
190
        {
191
192
        }
193
194
        private void listView1_SelectedIndexChanged(object sender, EventArgs e)
195
        {
196
197
        }
198
199
        private void pictureBox1_Click(object sender, EventArgs e)
200
        {
201
202
        }
203
204
        private void textBox5_TextChanged(object sender, EventArgs e)
205
        {
206
        }
207-
           textBox5.Clear();
207+
208
        private void button3_Click(object sender, EventArgs e)
209
        {
210
            string connString = "Server=localhost;Database=request;Uid=root;Pwd=;";
211
            using (MySqlConnection mcon = new MySqlConnection(connString))
212
            using (MySqlCommand cmd = mcon.CreateCommand())
213
            {
214
                mcon.Open();
215
                cmd.CommandText = "SELECT * FROM requesttcw";
216
                using (MySqlDataReader reader = cmd.ExecuteReader())
217
                {
218
                    while (reader.Read())
219
                    {
220
                        Console.WriteLine(reader["ID"]);
221
                        Console.WriteLine(reader["ClanName"]);
222
                        Console.WriteLine(reader["Date"]);
223
                        Console.WriteLine(reader["Type"]);
224
                        Console.WriteLine(reader["Rules"]);
225
			textBox5.text = reader["ID"];
226
                    }
227
                }
228
            }
229
230
231
            using (MySqlConnection mcon = new MySqlConnection(connString))
232
            using (MySqlCommand cmd = mcon.CreateCommand())
233
            {
234
                mcon.Open();
235
                cmd.CommandText = "UPDATE FROM* requesttcw (ClanName, Date, Type, Rules) VALUES (@ClanName, @Date, @Type, @Rules)";
236
                cmd.Parameters.AddWithValue("@ClanName", textBox1.Text);
237
                cmd.Parameters.AddWithValue("@Date", textBox2.Text);
238
                cmd.Parameters.AddWithValue("@Type", textBox3.Text);
239
                cmd.Parameters.AddWithValue("@Rules", richTextBox1.Text);
240
                cmd.ExecuteNonQuery();
241
            }
242
        }
243
    }
244
}