コード例 #1
0
 private void button1_Click(object sender, EventArgs e)
 {
     if (textStationId.Text == null || textStationId.Text == "" || txtDate.Text == null || txtDate.Text == "" || txtTime.Text == null || txtTime.Text == "")
     {
         MessageBox.Show("הנתונים לא מלאים");
     }
     else
     {
         try
         {
             //DateTime date11 = DateTime.ParseExact(txtDate.Text,
             //               "MM-dd-yyyy");
             //DateTime instance = DateTime.Parse(txtDate.Text);
             strSQL = "select tblRefeul.StationId,StandId,[RefeulAmount(L)],date1,time1 from tblRefeul inner join tblShift on tblRefeul.StationId=tblShift.stationId where tblshift.StationId =" + textStationId.Text + " and time1 between tblShift.startTime and tblShift.EndTime and tblShift.startTime= " + "'" + txtTime.Text + "'" + "and date1=" + "'" + txtDate.Text + "'";
             ClientDA sqlCmd = new ClientDA(strSQL);
             dgReport.DataSource = sqlCmd.datatable();
         }
         catch (Exception ex)
         {
             MessageBox.Show(ex.Message);
         }
     }
 }