Discussion:
Date Condition in Where in Visual FOxpro
(too old to reply)
g***@gmail.com
2006-04-17 17:19:52 UTC
Permalink
I am having problem in Date Condition in Visual foxpro.
e.g if i have table naming rootrf which contains xn_dt as datetime
field. I want to filter out records with specific date from rootrf
table in Visual Basic 6.0 using Visual Foxpro database.
Thanks
Waiting.....
Cindy Winegarden
2006-04-17 19:30:51 UTC
Permalink
Hi,

I'm a little confused. Are you working (programming) in Visual FoxPro with
your Fox tables, or are you using VB6 as a front end to the Fox tables?
Also, since Visual FoxPro has both a Date data type and a DateTime data
type, can you confirm which one you are working with?

There are several ways to represent dates/datetimes in text such as a SQL
pass-through statement. For one, you can surround Dates or DateTimes with
curly braces. Another way is to use some VFP functions such as Date(nYear,
nMonth, nDay), i.e. Date(2006, 04, 17) or
DATETIME([nYear, nMonth, nDay [, nHours [, nMinutes [, nSeconds]]]])

So, your SQL could look like strSQL = "Select * From MyTable Where
MyDateTime = Date(2006, 05, 01)"

Try that, and if you're still having trouble post the connection string and
the code you've got so far.
--
Cindy Winegarden MCSD, Microsoft Visual FoxPro MVP
Post by g***@gmail.com
I am having problem in Date Condition in Visual foxpro.
e.g if i have table naming rootrf which contains xn_dt as datetime
field. I want to filter out records with specific date from rootrf
table in Visual Basic 6.0 using Visual Foxpro database.
Thanks
Waiting.....
Loading...