private void Cb_Date_SelectedIndexChanged(object sender, EventArgs e) { string AllHistory = "All History"; AllHistory = cb_Date.ToString(); if (cb_Date.SelectedItem.ToString() == "All History") { HistoryLogs hl = new HistoryLogs(); this.Close(); hl.Show(); } else { string hisdate = "SELECT Entryno,UserID,Task,Time FROM tbl_History WHERE Date = '" + cb_Date.SelectedItem.ToString() + "' ORDER BY Entryno"; SqlCommand hdtcmd = new SqlCommand(hisdate, con); hdtcmd.ExecuteNonQuery(); DataTable dtdate = new DataTable(); SqlDataAdapter sdate = new SqlDataAdapter(hdtcmd); sdate.Fill(dtdate); foreach (DataRow dr in dtdate.Rows) { dg_HLogs.DataSource = dtdate; } } }
private void Button_History_Click(object sender, EventArgs e) { HistoryLogs hl = new HistoryLogs(); hl.Show(); }