Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to specify date range for query (VFP9 OleDB)
Message
 
 
To
All
General information
Forum:
ASP.NET
Category:
Other
Title:
How to specify date range for query (VFP9 OleDB)
Environment versions
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01099668
Message ID:
01099668
Views:
118
I have a fairly complex query that works fine in ASP.NET, returning the results in a sortable datagrid. Now I just need to be able to filter by date, so I've got two text boxes to collect the start and end date, which I then stick on the end of the URL:

callingURL.aspx/?ID=1302&d1=7/1/2005&d2=7/31/2005

I'm then able to grab the two dates:

dim dRdate1 as string = Request.Item("d1")
dim dRdate2 as string = Request.Item("d2")

But I keep getting operator/operand type mismatches when I go to the page. Here's a simplified version of the code:
dim MySql as string=String.Format("select sdate1,sdate2,Title from Sess " + _    
"where id_code={0} and between(sdate1," & dRdate1 & "," & dRdate2 & "), Request.Item("ID"))
In the BETWEEN() function I've tried putting the variables in quotes, CTOD(), even tried #dRdate1# (most of the examples I could find are for Access). Also tried defining the variables as date instead of string. Also tried not using BETWEEN():
"where id_code={0} and sdate1 >= " & dRdate1 & " and sdate1 <=" & dRdate2, Request.Item("ID"))
I'm probably making this a lot harder than it needs to be. Could someone point out how to get these dates to work? Any suggestions appreciated.
Next
Reply
Map
View

Click here to load this message in the networking platform