6
Answers

using multiple datetimepicker in c# with MySql

Alex Calidguid

Alex Calidguid

10y
1.3k
1
I am using 2 datetimepicker.
 
1) any date select from first datetimepicker.
 
2) then another one date is select from second datetime picker.
 
my request is: the second datetimepicker selecting date only accept after first date.
how to compare from first date and second date.
 
EXAMPLE:
 
i.e) first selected date is 10/10/2011 ok.
 
then second datetimepicker selecting date accept only after first date i.e 11/10/2011
 
but can not accept before date that is 09/10/2011.

here's the code:

cnn.cmdOpen(cmdForm);
            cmdForm.CommandText = " SELECT attendance.work,attendance.in_, attendance.out_,attendance.weekday,"
                + "attendance.date,employee.Empname,employee.Empno"
                 + " FROM employee LEFT JOIN attendance ON employee.biomitricno = attendance.badgeno WHERE date >='" + DtFrom.Value.ToString() + "' AND date <='" + DtTo.Value.ToString() + "'";

 

            MySqlDataAdapter da = new MySqlDataAdapter();
            da.SelectCommand = cmdForm;
            DataTable dtble = new DataTable();

            da.Fill(dtble);
            BindingSource bSource = new BindingSource();

            bSource.DataSource = dtble;
            dgVMonthly.DataSource = bSource;






Answers (6)