ASP with SQL Command problem

ASP with SQL Command problem

am 06.11.2004 05:40:15 von iamnot

strSQL = "SELECT * FROM list"
strSQL = strSQL & " Where date1 > '10/30/2004' and date1 < '11/2/2004'"

It returns the result:


date1
-----------
1/1/2004
10/7/2004
10/5/2004
10/4/2004

Why does it not match the range?

Re: ASP with SQL Command problem

am 06.11.2004 07:53:58 von unknown

Is your column a date type, i.e. datetime or smalldatetime? If not, your <
and > comparisons will be text-based.

Also, read up on date formats here: http://www.aspfaq.com/show.asp?id=2260

Additionally, what database type?

Ray at home

"(^_^)" wrote in message
news:BDB276AF.F85%iamnot@home.com...
> strSQL = "SELECT * FROM list"
> strSQL = strSQL & " Where date1 > '10/30/2004' and date1 < '11/2/2004'"
>
> It returns the result:
>
>
> date1
> -----------
> 1/1/2004
> 10/7/2004
> 10/5/2004
> 10/4/2004
>
> Why does it not match the range?
>

Re: ASP with SQL Command problem

am 06.11.2004 14:46:51 von reb01501

(^_^) wrote:
> strSQL = "SELECT * FROM list"
> strSQL = strSQL & " Where date1 > '10/30/2004' and date1 <
> '11/2/2004'"
>
> It returns the result:
>
>
> date1
> -----------
> 1/1/2004
> 10/7/2004
> 10/5/2004
> 10/4/2004
>
> Why does it not match the range?

What database type and version are you using?
What is the datatype of the date1 column?
Why does the column name have a number in it? This is usually an indication
of less-than-optimum database design.

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"

Re: ASP with SQL Command problem

am 08.11.2004 11:34:46 von iamnot

It is general datetime.

in article uEOJxz8wEHA.1976@TK2MSFTNGP09.phx.gbl, Ray Costanzo [MVP] at my
first name at lane 34 dot commercial wrote on 6/11/04 14:53:

> Is your column a date type, i.e. datetime or smalldatetime? If not, your <
> and > comparisons will be text-based.
>
> Also, read up on date formats here: http://www.aspfaq.com/show.asp?id=2260
>
> Additionally, what database type?
>
> Ray at home
>
> "(^_^)" wrote in message
> news:BDB276AF.F85%iamnot@home.com...
>> strSQL = "SELECT * FROM list"
>> strSQL = strSQL & " Where date1 > '10/30/2004' and date1 < '11/2/2004'"
>>
>> It returns the result:
>>
>>
>> date1
>> -----------
>> 1/1/2004
>> 10/7/2004
>> 10/5/2004
>> 10/4/2004
>>
>> Why does it not match the range?
>>
>
>