 |
| 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
|
|
|
|

January 17th, 2005, 06:44 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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? :(
|
|

January 17th, 2005, 06:56 AM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Please let me know which database you are using.
Also, detail on the field types used in the database.
|
|

January 17th, 2005, 07:11 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
I`m using MS Access
I`ve set "dato" field in type date.
|
|

January 17th, 2005, 07:13 AM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.:)
|
|

January 17th, 2005, 07:21 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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?
|
|

January 17th, 2005, 07:31 AM
|
|
Authorized User
|
|
Join Date: Aug 2004
Posts: 58
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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..
|
|

January 17th, 2005, 07:39 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
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.
|
|

January 17th, 2005, 06:34 PM
|
|
Friend of Wrox
|
|
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
|
|
;;;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
|
|

January 18th, 2005, 09:41 AM
|
|
Friend of Wrox
|
|
Join Date: May 2004
Posts: 105
Thanks: 0
Thanked 0 Times in 0 Posts
|
|
Thank you people...! I had an error with my connection to the db! :(
Sorry for my late reply...
|
|
 |