If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > Date Search Problem - HELP !!

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-25-03, 07:04
donaldt donaldt is offline
Registered User
 
Join Date: Jan 2002
Location: Nottingham - UK
Posts: 113
Date Search Problem - HELP !!

Hi peeps

I am trying to do a date range search on a sql db - I have a field named date in a date format.

I am using to input fields to do a date range search - the error I am getting back is below:

[Microsoft][ODBC SQL Server Driver][SQL Server]Syntax error converting datetime from character string.

Can anyone help me pls !!

Thanks
Reply With Quote
  #2 (permalink)  
Old 07-28-03, 20:15
unatratnag unatratnag is offline
Registered User
 
Join Date: Jul 2003
Location: Ohio/Chicago
Posts: 75
Hi donaldt,

I can't say i know for sure without seeing how you are entering the date in your input, You'll need to make sure it's the same format as that in the DB since some don't use hours and seconds, some use time zone etc...

here's some code I've used before.

querystring = "select * " & _
"from request_received " & _
"where start_date < " & input1 & _
" AND " & _
"end_date > " & input2

I fully recommend you hardcode into the dbms first and get the query working with constants, THEN put the variables in, it should work then without hitches if you get constants to go in.
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On