|
 |
asp_databases thread: how do I right the SQL Query to select between dates?"
Message #1 by wswyght@t... on Fri, 9 Jun 2000 17:19:15 GMT
|
|
I have put in my dataBase a DataType of Date/Time,
Now on the page I want to use the following code
DoSQL=3DDoSQL & " Data_Sheet.Date BETWEEN "
=09=09DoSQL=3DDoSQL & (DATE()-RTdays)
=09=09DoSQL=3DDoSQL & " AND "
=09=09DoSQL=3DDoSQL & DATE()=09
If I run this I get the error
Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
[Microsoft][ODBC Microsoft Access Driver]Division by zero (null)
/partners/BuildSQL.inc, line 23
Line 23 is
objRS.Open DoSQL, objConn
My SQL code works great if I take this section of the SQL out. (the date part)
Question is "how do I right the SQL Query to select between dates?"
IN the DataBase the date shows as 14-Mar-2000
IN the ASP Query the date shows as 03-14-00, now do I over come this stuff.
My book Beginning ASP Databases does not tell me about this.
Message #2 by Martin Maurais <martin@t...> on Sat, 10 Jun 2000 12:07:10 -0700
|
|
Try putting # around your dates:
DoSQL=DoSQL & " Data_Sheet.Date BETWEEN #"
DoSQL=DoSQL & (DATE()-RTdays)
DoSQL=DoSQL & "# AND #"
DoSQL=DoSQL & DATE()
DoSQL=DoSQL & "#;"
--
Martin Maurais
Tribeworks, Computer Systems Analyst
martin@t...
(xxx) xxx-xxxx
988 Market St. 8th Fl. SF, Ca 94102
http://www.tribeworks.com
> I have put in my dataBase a DataType of Date/Time,
> Now on the page I want to use the following code
>
> DoSQL=DoSQL & " Data_Sheet.Date BETWEEN "
> DoSQL=DoSQL & (DATE()-RTdays)
> DoSQL=DoSQL & " AND "
> DoSQL=DoSQL & DATE()
>
> If I run this I get the error
>
> Microsoft OLE DB Provider for ODBC Drivers error '80040e14'
>
> [Microsoft][ODBC Microsoft Access Driver]Division by zero (null)
>
> /partners/BuildSQL.inc, line 23
>
> Line 23 is
>
> objRS.Open DoSQL, objConn
>
> My SQL code works great if I take this section of the SQL out. (the date part)
>
> Question is "how do I right the SQL Query to select between dates?"
>
> IN the DataBase the date shows as 14-Mar-2000
> IN the ASP Query the date shows as 03-14-00, now do I over come this stuff.
> My book Beginning ASP Databases does not tell me about this.
Message #3 by "Warren S. Wyght" <wswyght@t...> on Sun, 11 Jun 2000 15:55:36 -0600
|
|
Thank you very much for this information. By the way it works now thanks again.
Warren
Martin Maurais wrote:
> Try putting # around your dates:
>
> DoSQL=DoSQL & " Data_Sheet.Date BETWEEN #"
> DoSQL=DoSQL & (DATE()-RTdays)
> DoSQL=DoSQL & "# AND #"
> DoSQL=DoSQL & DATE()
> DoSQL=DoSQL & "#;"
>
|
|
 |