Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to specify date range for query (VFP9 OleDB)
Message
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Autre
Titre:
How to specify date range for query (VFP9 OleDB)
Versions des environnements
Environment:
VB.NET 1.1
OS:
Windows XP SP2
Database:
Visual FoxPro
Divers
Thread ID:
01099668
Message ID:
01099668
Vues:
119
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.
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform