Sunday, September 5, 2010

How to use datetimepicker in a sql query using c# ?

You can use the below sql query to populate data from a table for between 2 dates using datetimepicker in c#:

"select * from Table_Name where column1_name>='" +dateTimePicker1.Value.ToString("yyyyMMdd") + "' and column2_name<='" + dateTimePicker2.Value.ToString("yyyyMMdd") + "' "

1 comment:

  1. this will check only string value not data type value...............

    ReplyDelete