karthirajendran
New member
- Local time
- Yesterday, 22:21
- Joined
- Jul 8, 2009
- Messages
- 2
Hi ,
I am developing an application in c#.net with Ms-Access as the database. I need to findout whether a date entered by the user falls between the 'from_date' & 'to_date' fields in a table.
Ex:
sno from date To date
1 08-jul-09 09-jul-09
2 14-jul-09 16-jul-09
3 13-jul-09 13-jul-09
4 21-jul-09 22-jul-09
5 06-jul-09 06-jul-09
6 01-jul-09 01-jul-09
I have used the query
string sdatecheck = "select * from LeaveMaster_Table where ( #" + this.Txt_Fromdate.Text + "# >= From_Date and #" + this.Txt_Fromdate.Text + "# <= To_Date) or (#" + this.Txt_Fromdate.Text + "# = From_Date and #" + this.Txt_Fromdate.Text + "#= To_Date)and Emp_ID = '" + ssempid.ToString() + "' and If_Approved = 'APPROVED'";
if I enter from_date as 7/2/2009 & to_date as 07/13/2009 it did not brings out the records 1, 3 & 5 as per the table.
Any help would be appreciated....
Thanks,
Karthi
I am developing an application in c#.net with Ms-Access as the database. I need to findout whether a date entered by the user falls between the 'from_date' & 'to_date' fields in a table.
Ex:
sno from date To date
1 08-jul-09 09-jul-09
2 14-jul-09 16-jul-09
3 13-jul-09 13-jul-09
4 21-jul-09 22-jul-09
5 06-jul-09 06-jul-09
6 01-jul-09 01-jul-09
I have used the query
string sdatecheck = "select * from LeaveMaster_Table where ( #" + this.Txt_Fromdate.Text + "# >= From_Date and #" + this.Txt_Fromdate.Text + "# <= To_Date) or (#" + this.Txt_Fromdate.Text + "# = From_Date and #" + this.Txt_Fromdate.Text + "#= To_Date)and Emp_ID = '" + ssempid.ToString() + "' and If_Approved = 'APPROVED'";
if I enter from_date as 7/2/2009 & to_date as 07/13/2009 it did not brings out the records 1, 3 & 5 as per the table.
Any help would be appreciated....
Thanks,
Karthi
Last edited: