Hi
I have one column called date in database and my database datecolumn contain like this 2013-02-22,but in front end iam using 2 ajaxdate pickers and searching for a record
i am writing the query like this,i want to know whether it is correct or not
SELECT * from table where Date between ='" + txtfromdate.Text + "and" +txttodate +"'";
How to search a record from database by date range.
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.

Rajneesh RaiRank #1,902 · 777 reputationPosted Mar 4, 2013, 3:48 PM EST
use
SELECT * from table where Date between '" + txtfromdate.Text + "' and '" +txttodate.Text +"'";
Mark this as accepted answer if your problem solved.
Sreejesh SPRank #1,975 · 740 reputationPosted Mar 4, 2013, 5:58 PM EST
Sql date format difference in c# date format ,so first u change c# date format to sql then Apply your query,that date column is string so ur query is correct,so check ur table
thanks
Sreejesh