-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathcode.txt
More file actions
29 lines (25 loc) · 1.15 KB
/
code.txt
File metadata and controls
29 lines (25 loc) · 1.15 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
DataSet2 ds = new DataSet2();
MySqlCommand cmd = con.CreateCommand();
cmd.CommandType = CommandType.Text;
cmd.CommandText = "Select * from order_user where id='"+ j +"'";
cmd.ExecuteNonQuery();
DataTable dt = new DataTable();
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
da.Fill(ds.DataTable1);
MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandType = CommandType.Text;
cmd2.CommandText = "Select * from order_item where order_id='" + j + "'";
cmd2.ExecuteNonQuery();
DataTable dt2 = new DataTable();
MySqlDataAdapter da2 = new MySqlDataAdapter(cmd2);
da2.Fill(ds.DataTable2);
da2.Fill(dt2);
tot = 0;
foreach(DataRow dr2 in dt2.Rows)
{
tot = tot + Convert.ToInt32(dr2["total"].ToString());
}
CrystalReport1 myreport = new CrystalReport1();
myreport.SetDataSource(ds);
myreport.SetParameterValue("total", tot.ToString());
crystalReportViewer1.ReportSource = myreport;