james james

james james

  • NA
  • 419
  • 30k

C# winform access database search multi datagrid for date

Jan 1 2018 8:35 PM
Happy New Year to all,
 
I have a winform with 7 tabs (Tab Control) 6 of them have a datagrid with different information. The 7th tab has all the datagrid on it.
 
I need to enter a date on the 7th tab that will retrieve all information from that date for each grid button click. The Access database has 6 tables, the code is as simple as it gets to store information.
 
  1. using System;    
  2. using System.Collections.Generic;    
  3. using System.ComponentModel;    
  4. using System.Data;    
  5. using System.Drawing;    
  6. using System.Linq;    
  7. using System.Text;    
  8. using System.Threading.Tasks;    
  9. using System.Windows.Forms;    
  10.     
  11.     
  12. namespace Shift_End_Report    
  13. {    
  14.     public partial class Form1 : Form    
  15.     {    
  16.         public Form1()    
  17.         {    
  18.             InitializeComponent();    
  19.         }    
  20.     
  21.         private void Form1_Load(object sender, EventArgs e)    
  22.         {    
  23.             // TODO: This line of code loads data into the 'shift_End_Report_3DataSet.Restriction_Accommodation' table. You can move, or remove it, as needed.    
  24.             this.restriction_AccommodationTableAdapter.Fill(this.shift_End_Report_3DataSet.Restriction_Accommodation);    
  25.             // TODO: This line of code loads data into the 'shift_End_Report_3DataSet.Open_Part_Issues' table. You can move, or remove it, as needed.    
  26.             this.open_Part_IssuesTableAdapter.Fill(this.shift_End_Report_3DataSet.Open_Part_Issues);    
  27.             // TODO: This line of code loads data into the 'shift_End_Report_3DataSet.SSAR' table. You can move, or remove it, as needed.    
  28.             this.sSARTableAdapter.Fill(this.shift_End_Report_3DataSet.SSAR);    
  29.             // TODO: This line of code loads data into the 'shift_End_Report_3DataSet.Hot_Calls' table. You can move, or remove it, as needed.    
  30.             this.hot_CallsTableAdapter.Fill(this.shift_End_Report_3DataSet.Hot_Calls);    
  31.             // TODO: This line of code loads data into the 'shift_End_Report_3DataSet.Attendance' table. You can move, or remove it, as needed.    
  32.             this.attendanceTableAdapter.Fill(this.shift_End_Report_3DataSet.Attendance);    
  33.             // TODO: This line of code loads data into the 'shift_End_Report_3DataSet.Part_Shortage' table. You can move, or remove it, as needed.    
  34.             this.part_ShortageTableAdapter.Fill(this.shift_End_Report_3DataSet.Part_Shortage);    
  35.     
  36.         }    
  37.         #region Part Shortage Buttons    
  38.         private void btn_PS_Add_Click(object sender, EventArgs e)    
  39.         {    
  40.             this.partShortageBindingSource.AddNew();    
  41.         }    
  42.     
  43.         private void btn_PS_Save_Click(object sender, EventArgs e)    
  44.         {    
  45.             this.Validate();    
  46.             this.partShortageBindingSource.EndEdit();    
  47.             this.part_ShortageTableAdapter.Update(this.shift_End_Report_3DataSet);    
  48.             this.part_ShortageTableAdapter.Fill(this.shift_End_Report_3DataSet.Part_Shortage);    
  49.     
  50.         }    
  51.             
  52.         private void btn_PS_Next_Click(object sender, EventArgs e)    
  53.         {    
  54.             this.partShortageBindingSource.MoveNext();    
  55.         }    
  56.     
  57.         private void btn_PS_Previous_Click(object sender, EventArgs e)    
  58.         {    
  59.             this.partShortageBindingSource.MovePrevious();    
  60.         }    
  61.     
  62.         private void btn_PS_Delete_Click(object sender, EventArgs e)    
  63.         {    
  64.             this.partShortageBindingSource.RemoveCurrent();    
  65.         }    
  66.     
  67.         private void btn_PS_Exit_Click(object sender, EventArgs e)    
  68.         {    
  69.             var result = MessageBox.Show("Are you sure you would like to exit?""Closing Program",    
  70.             MessageBoxButtons.YesNo, MessageBoxIcon.Question);    
  71.     
  72.             if (result == DialogResult.Yes)    
  73.             {    
  74.                 Application.Exit();    
  75.     
  76.             }    
  77.             #endregion    
  78.         }    
  79.   
  80.         #region Attendance Buttons    
  81.          
  82.         #endregion    
  83.   
  84.         #region Hot Sheet Button    
  85.   
  86.           
  87.             #endregion    
  88.         }    
  89.   
  90.         #region SSAR Buttons    
  91.           
  92.             #endregion    
  93.         }    
  94.   
  95.         #region Open Part Button    
  96.         
  97.             #endregion    
  98.         }    
  99.   
  100.         #region Restriction Buttons    
  101.   
  102.         
  103. #endregion    
  104.         }    
  105.     
  106.         private void btn_Date_Click(object sender, EventArgs e)    
  107.         {    
  108.     
  109.         }    
  110.     }    
  111. }  
 

Answers (1)