-
Notifications
You must be signed in to change notification settings - Fork 0
/
frm3cCusHY.cs
52 lines (45 loc) · 1.7 KB
/
frm3cCusHY.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
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Configuration;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;
namespace IOOP
{
public partial class frm3cCusHY : Form
{
public static string cusName;
static SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["myCS"].ToString());
public frm3cCusHY()
{
InitializeComponent();
}
public frm3cCusHY(string cn)
{
InitializeComponent();
cusName = cn;
}
private void frm3bCusHY_Load(object sender, EventArgs e)
{
con.Open();
// Select data according the customer name and services status were completed
SqlDataAdapter sqlda = new SqlDataAdapter("select " +
"id, customerName, serviceType, serviceDemand, fee, requestDate, completionDate, remark, collectionDate " +
"from services where customerName = '" + cusName + "' and status = 'Completed'", con);
DataTable ftbl = new DataTable();// Create a new table
sqlda.Fill(ftbl);// Adds the dataset into table
dgvCusRS.AutoGenerateColumns = false;// Stop auto generate one more columns in last column
dgvCusRS.DataSource = ftbl;// This DataGridView will display data for this table(dtbl)
con.Close();
}
private void dgvCusRS_CellContentClick(object sender, DataGridViewCellEventArgs e)
{
}
}
}