Wrox Programmer Forums
|
Classic ASP Basics For beginner programmers starting with "classic" ASP 3, pre-".NET." NOT for ASP.NET 1.0, 1.1, or 2.0
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Basics section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old January 17th, 2005, 06:44 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default What`s wrong with Query??? :(

Hello Guyz!!!

I`ve got the following code...
<%
Dim oRSbn
Set oRSbn=server.createobject("ADODB.recordset")
hi = "1/1/1980"
hi1 = "1/1/2010"
sqltext = "Select * from fotofiles WHERE dato BETWEEN '"& hi &"' AND '"& hi1 &"';"
oRSbn.open sqltext, conn
if (oRSbn.EOF) then
response.write oRSbn("dato")
end if
response.write hi
response.write hi1
%>
I get the following error
----------------
Error Type:
ADODB.Recordset (0x800A0BB9)
Unknown runtime error
/1.asp, line 7
-----------------
What`s wrong? :(
 
Old January 17th, 2005, 06:56 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Please let me know which database you are using.
Also, detail on the field types used in the database.

 
Old January 17th, 2005, 07:11 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I`m using MS Access

I`ve set "dato" field in type date.
 
Old January 17th, 2005, 07:13 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Then use "#" instead of "'" to compare the date value.

ie.
sqltext = "Select * from fotofiles WHERE dato BETWEEN $"& hi &"# AND #"& hi1 &"#;"

Let me know if it works out.:)

 
Old January 17th, 2005, 07:21 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you for your reply... But no... It`s not working!

You have a "$" which I tried also with "#" and again it doesn`t work. :(
Any other ideas?
 
Old January 17th, 2005, 07:31 AM
Authorized User
 
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Did you get the same error?

I just got mis-spelled
it is not "$", it is always "#" surrounded for date in MS Access

Can you post your latest SQL query..




 
Old January 17th, 2005, 07:39 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default

sqltext = "Select * from fotofiles WHERE dato BETWEEN #"& hi &"# AND #"& hi1 &"#;"

:( I understood that you misspelled that.. but even with the # is not working for me.
 
Old January 17th, 2005, 06:34 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

;;;is not working for me

Your query looks good to me post your exact error and run time behaviours for a useful solution. I would:
1..Check your variables hi and hi1 are valid date data types
2..Hardcode dates in place of your variables to eliminate this as a problem
3..Comment out the execute() then write your query to screen, copy n pasted it directly into Acesss and run it?




Wind is your friend
Matt
 
Old January 18th, 2005, 09:41 AM
Friend of Wrox
 
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thank you people...! I had an error with my connection to the db! :(

Sorry for my late reply...





Similar Threads
Thread Thread Starter Forum Replies Last Post
What is wrong with following Insert Query? [email protected] VB.NET 2002/2003 Basics 1 September 19th, 2006 04:41 PM
What is wrong with this query?... rupen Access 5 April 30th, 2006 01:28 AM
Query on the wrong data type ggiibboo VB Databases Basics 1 January 31st, 2006 07:44 PM
Wrong result on select query penta Access 3 May 5th, 2005 09:05 AM
What is wrong with this Query? Section? xgbnow Pro VB Databases 3 February 9th, 2004 05:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.