Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- OleDbConnection Conn = new OleDbConnection(Program.ConnString);
- Conn.Open();
- OleDbCommand Cmd = new OleDbCommand();
- Cmd.Connection = Conn;
- DateTime StartDate = DateTime.Today.AddDays(-7);
- string strStart = StartDate.ToString("dd/MM/yyyy");
- DateTime EndDate = DateTime.Today;
- string strEnd = EndDate.ToString("dd/MM/yyyy");
- string SQL = "";
- if (list_all.Checked)
- {
- SQL = "SELECT StudentID, Forename, Surname, Class FROM Accounts ";
- }
- else if (current_week.Checked)
- {
- SQL = "SELECT * FROM Transactions ";
- SQL += "WHERE TransDate BETWEEN #" + strStart + "# AND #" + strEnd + "# ";
- SQL += "GROUP BY TransType";
- }
- else if (this_weeks_totals.Checked)
- {
- SQL = "SELECT TransType, SUM(Amount) AS Total FROM Transactions ";
- SQL += "WHERE TransDate BETWEEN #" + strStart + "# AND #" + strEnd + "# ";
- SQL += "GROUP BY TransType";
- }
- else if (particualr_account.Checked)
- {
- SQL = "SELECT TransDate, TransType, Amount FROM Transactions ";
- SQL += "WHERE StudentID='" + textBoxid.Text + "' ORDER BY TransDate";
- SQL += "GROUP BY TransType";
- }
- Cmd.CommandText = SQL;
- OleDbDataAdapter da = new OleDbDataAdapter(Cmd);
- DataTable table = new DataTable();
- da.Fill(table);
- grid.DataSource = table;
- Conn.Close();
- grid.Show();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement