-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNew Text Document.txt
More file actions
42 lines (36 loc) · 1.42 KB
/
New Text Document.txt
File metadata and controls
42 lines (36 loc) · 1.42 KB
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
private void button5_Click(object sender, EventArgs e)
{
//Search Button
try
{
//search.SelectCommand = new MySqlCommand("SELECT * FROM customer WHERE CONCAT('customerId', 'customerName', 'createdBy', 'lastUpdateBy') LIKE '" + textBox5.Text + "'", con);
search.SelectCommand = new MySqlCommand("SELECT * FROM customer WHERE customerId LIKE '%" + textBox5.Text + "%' OR customerName LIKE '%" + textBox5.Text + "%' OR createdBy LIKE '%" + textBox5.Text + "%' OR lastUpdateBy LIKE '%" + textBox5.Text + "%'", con);
DataTable custTableView = new DataTable();
search.Fill(custTableView);
BindingSource customerSearch = new BindingSource();
customerSearch.DataSource = custTableView;
search.Update(custTableView);
dataGridView1.DataSource = custTableView;
}
catch (Exception x)
{
MessageBox.Show(x.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
private void button6_Click(object sender, EventArgs e)
{
//Clear Button
try
{
{
cust.SelectCommand = new MySqlCommand("SELECT * FROM customer", con);
DataTable custTableView = new DataTable();
cust.Fill(custTableView);
dataGridView1.DataSource = custTableView;
}
}
catch (Exception x)
{
MessageBox.Show(x.ToString(), "Message", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}