private void VIPCustomer_Load(object sender, EventArgs e) { strSQL = "select distinct FullName,Address,PhoneNum,Email,MemberId from tblCustomer inner join tblRefeul on tblCustomer.licenseNum=tblRefeul.licenseNum where tblRefeul.date1 >= DATEADD(MONTH, -4, GETDATE()) and tblCustomer.licenseNum in (SELECT licenseNum FROM tblRefeul GROUP BY month(tblRefeul.date1),licenseNum HAVING COUNT(licenseNum) > 2);"; ClientDA sqlCmd = new ClientDA(strSQL); dgClient.DataSource = sqlCmd.datatable(); }
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); } } }