
May 30th, 2002, 04:22 AM
|
|
Contributing User
|
|
Join Date: Dec 2002
Posts: 14,578
  
Time spent in forums: < 1 sec
Reputation Power: 22
|
|
|
<i><b>Originally posted by : Mohammad Jamous (jamouss@hotmail.com)</b></i><br />Hi Jimmy<br /><br />I face this problem before and i solve it like this way<br /><br />u have to convert the String of Date to Date or DateTime object and that come like this<br />********************<br />dim dt as DateTime<br /><br />dt = CDate(BeginDate)<br /><br />be care that BeginDate should be in this format (MM/dd/yyyy hh:mm:ss tt) for DateTime and (MM/dd/yyyy) for Date else it will give u an exception.<br /><br />If you need any more info , u can send me an Email.<br /><br />Best Regards<br /><br /><br />------------<br />Jimmy at 5/29/2002 4:20:36 PM<br /><br />I have a question about comparing dates in SOL.<br />I try to select record from database according to the date using:<br />Orders.Source = "SELECT * From Table WHERE SomeDate BETWEEN " & "#" & BeginDate & "#" & " AND " & "#" & EndDate & "#"<br /><br />where BeginDate and EndDate are all in format mm/dd/yyyy and I believe the field "SomeDate" in database is with type "TEXT" and format mm/dd/yyyy<br /><br />The result seems that in this way, the Dates are compared by value of "String" instead of "Date", which is not what I want. I type using CAST in my SQL command, Like CAST(SomeDate AS Date), it did n't work either.<br /><br />I don't think I can change the data type in database. So is there any way I can solve my problem?<br /><br />Thank you for your help.<br /><br /><br /><br />Jimmy<br /><br />
|