Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Am I tired ?
Message
From
12/02/2008 09:35:49
 
 
To
12/02/2008 09:13:07
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
General information
Forum:
Visual FoxPro
Category:
Coding, syntax & commands
Title:
Miscellaneous
Thread ID:
01291041
Message ID:
01291789
Views:
18
>>>>Hi Cetin,
>>>>
>>>>In fact I am fighting whole day with DataCalendar example by Mike Ellison and here is
>>>>problem:
>>>>
>>>>
>>>>
>>>>cmd.CommandText =
>>>>String.Format("Select * From EventInfo Where EventDate >= #{0}# And EventDate <= #{1}#",
>>>>              startDate, endDate);
>>>>....
>>>>
>>>>DateTime startDate = new DateTime(cal1.VisibleDate.Year, cal1.VisibleDate.Month, 1).AddDays(-7);
>>>>DateTime endDate = new DateTime(cal1.VisibleDate.Date.AddMonths(1).Year, cal1.VisibleDate.Date.AddMonths(1).Month, 1).AddDays(7);
>>>>
>>>>
>>>>
>>>>this gives error because date must be in form MM/dd/yyyy
>>>>
>>>>if I put hardcoded dates like
>>>>
>>>>cmd.CommandText =
>>>>"Select * From EventInfo Where EventDate >= #03/03/2007# And EventDate <= #11/24/2007#";
>>>>
>>>>that is working !
>>>>
>>>>How should i put in above string startDate and endDate in MM/dd/yyyy format
>>>
>>>
>>>DateTime startDate = new DateTime(cal1.VisibleDate.Year,
>>>                                  cal1.VisibleDate.Month, 1).AddDays(-7);
>>>DateTime endDate = new DateTime(cal1.VisibleDate.Date.AddMonths(1).Year,
>>>                                cal1.VisibleDate.Date.AddMonths(1).Month, 1).AddDays(7);
>>>
>>>cmd.CommandText =
>>> String.Format("Select * From EventInfo Where EventDate >= #{0}# And EventDate <= #{1}#",
>>> startDate.ToString("MM/dd/yyyy"),
>>> endDate.ToString("MM/dd/yyyy") );
>>>
>>>Cetin
>>
>>I know I misunderstood this one right from the beginning, but isn't this to query VFP data? Will the # # delimeters for a data work ?
>
>I don't know what it's for but to me it looks like a filter for ADO or Access data (ADO uses # for dates and probably Access, I don't know).
>Cetin

That's why I asked and I thought he said DBFs so I thought perhaps he was asking the question in the VFP forum because he wasn't sure about Foxpro date delimiters. Oh well, if it works for him I guess I just misread the whole thing ...


Charles Hankey

Though a good deal is too strange to be believed, nothing is too strange to have happened.
- Thomas Hardy

Half the harm that is done in this world is due to people who want to feel important. They don't mean to do harm-- but the harm does not interest them. Or they do not see it, or they justify it because they are absorbed in the endless struggle to think well of themselves.

-- T. S. Eliot
Democracy is two wolves and a sheep voting on what to have for lunch.
Liberty is a well-armed sheep contesting the vote.
- Ben Franklin

Pardon him, Theodotus. He is a barbarian, and thinks that the customs of his tribe and island are the laws of nature.
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform