i have 2 tables
1. report table (with fields (cols))
col1, col2, col3, col4, col5, col6, col7
values in row 1
col1 = "trx_no"
col2 = "trx_date"
col3 = "quantity"
col4 = "rate"
col4 = "quantity * rate"
col6 = "tax"
col7 = "(quantity * rate)+tax"
2. transaction table (with fields (cols))
trx_no, trx_date, quantity, rate, tax
value in row 1
trx_no = "00001"
trx_date = "01/04/2020"
quantity = 20
rate = 150
tax = 540
value in row 2
trx_no = "00002"
trx_date = "05/04/2020"
quantity = 100
rate = 110
tax = 1980
- private void TData_Grid(string RMST)
- {
- if (SPDConn.State != ConnectionState.Open)
- {
- SPDConn.Close();
- SPDConn.Open();
- }
- if (SPMConn.State != ConnectionState.Open)
- {
- SPMConn.Close();
- SPMConn.Open();
- }
- string str1 = "select * from dbo.trxdat" + SPGlobal.spyear + " where cmp_code = '" + SPGlobal.spcmp_code + "' and trx_type = '" + RMST + "'";
- SqlCommand mcmd = new SqlCommand(str1, SPDConn);
- SqlDataReader mrdr = mcmd.ExecuteReader();
- string trx_no;
- DateTime trx_date;
- decimal quantity, rate, tax;
- while (mrdr.Read())
- {
-
- trx_no = mrdr["trx_no"].ToString();
- trx_date = (DateTime)mrdr["trx_date"];
- quantity = (decimal)mrdr["quantity"];
- rate = (decimal)mrdr["rate"];
- tax = (decimal)mrdr["tax"];
- Console.WriteLine(col1);
- Console.WriteLine(col2);
- Console.WriteLine(col3);
- Console.WriteLine(col4);
- Console.WriteLine(col5);
- Console.WriteLine(col6);
- Console.WriteLine(col7);
- }
- mrdr.Close();
- }
how do i manupulate col1, col2, col3, ...... so that at console i get
note : datatables won't change they are read only
"00001"
"01/04/2020"
20
150
3000
540
3540