Author |
Topic |
Roland
Advanced Member
Netherlands
9335 Posts |
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 14:36:23
|
Okay, what about ORANGE?
You've got one long honkin' line in there where you're getting the error. Is it legal to put the end if statement on the same line as the if and else statements? Try splitting up that line.
Nikkol |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 14 March 2002 : 14:42:14
|
Well, that .txt file is a trimmed down version of the real file. The error appears in set rstTest = myConn.execute(strSql).
Yes, that long line actually works quite well as it shows the icon + link when there is a URL in the DB and it won't show anything if there's no URL.
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 15:43:07
|
Well this wont solve that problem, but theres a typo on line 43
set srs = nothing
s'be
set rs = nothing
ideally you should also put an rs.close() before that line also.
I find while loops a little easier to do also, you can just while not rs.eof .... do the work .... wend (would save a couple of lines of code there)
Right before the line giving you an error add in a debug line or 2
Response.write strSQL Response.End
This will just print out the querystring and end so you can see whats being passed to the connection in the execute statement.
www.daoc-halo.com
EDIT:grr hate the way wireless keyboard miss letters when you type too fast.
Edited by - Gremlin on 14 March 2002 15:44:36 |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 15:47:38
|
once you've added the debug code and have the query, fire up your DB in access and try entering the same query through QBE, you might find you get a more meaningfull error from there.
Another last minute thought ID isn't by chance a reserved word in access is it ?
www.daoc-halo.com |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 14 March 2002 : 15:52:01
|
I tried entering it like this: <% strSql = "SELECT COUNT(ID) AS DVD_COUNT FROM " & strTablePrefix & "DVD" set rstTest = myConn.execute(strSql) DVD_COUNT = rstTest("DVD_COUNT") Response.Write strSql Response.End %>
But that gives the same error as something appears to be missing from the second line (don't ask me why it says that though). When I uncomment the second and third lines, I get this as a result from the Response.Write strSql: SELECT COUNT(ID) AS DVD_COUNT FROM FORUM_DVD
I'll try renaming that field to DVD_ID just in case...
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 16:38:11
|
You could put your response.write line before you try to execute it. Just to be sure, you are establishing the connection to the database, yes?
Nikkol |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 14 March 2002 : 16:45:26
|
Yep, connection to the DB is made (I have the list of DVD's showing below and that works like a charm).
As I said, if I put it like this: <% strSql = "SELECT COUNT(ID) AS DVD_COUNT FROM " & strTablePrefix & "DVD" 'set rstTest = myConn.execute(strSql) 'DVD_COUNT = rstTest("DVD_COUNT") Response.Write strSql Response.End %>
I get this: SELECT COUNT(ID) AS DVD_COUNT FROM FORUM_DVD
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 16:48:06
|
Try this instead:
strSql = "SELECT COUNT(*) AS DVD_COUNT FROM " & strTablePrefix & "DVD"
Nikkol |
|
|
Doug G
Support Moderator
USA
6493 Posts |
Posted - 14 March 2002 : 16:51:10
|
You could try using COUNT(*) instead of COUNT(ID). Or, COUNT([ID]) is another option.
====== Doug G ====== |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 14 March 2002 : 16:53:26
|
quote:
Try this instead:
strSql = "SELECT COUNT(*) AS DVD_COUNT FROM " & strTablePrefix & "DVD"
Nikkol
Response.Write strSql results in SELECT COUNT(*) AS DVD_COUNT FROM FORUM_DVD
I've changed the ID cell to DVDID but that doesn't seem to help either
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 17:01:21
|
Can you update your text file of the changes you've made, so we can see it thus far?
Also, did you uncomment the execute line (it looked like you did that in one of your earlier posts)?
Nikkol
Edited by - Nikkol on 14 March 2002 17:08:15 |
|
|
Gremlin
General Help Moderator
New Zealand
7528 Posts |
Posted - 14 March 2002 : 17:18:25
|
What happens when you issue the SELECT COUNT(*) AS DVD_COUNT FROM FORUM_DVD from within Access rather than via an ASP page ?
www.daoc-halo.com |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 14 March 2002 : 17:25:10
|
Text file updated.
For clearity: - if I make the code like this: <% strSql = "SELECT COUNT(*) AS DVD_COUNT FROM " & strTablePrefix & "DVD" 'set rstTest = myConn.execute(strSql) 'DVD_COUNT = rstTest("DVD_COUNT") Response.Write strSql Response.End %>
I get the strSql on the page.
- if I make it like this: <% strSql = "SELECT COUNT(ID) AS DVD_COUNT FROM " & strTablePrefix & "DVD" set rstTest = myConn.execute(strSql) DVD_COUNT = rstTest("DVD_COUNT") 'Response.Write strSql 'Response.End %>
I get that line 19 error which is the one in red.
http://www.frutzle.com
Snitz Exchange | Do's and Dont's |
|
|
Nikkol
Forum Moderator
USA
6907 Posts |
Posted - 14 March 2002 : 17:31:24
|
quote:
- if I make it like this: <% strSql = "SELECT COUNT(ID) AS DVD_COUNT FROM " & strTablePrefix & "DVD" set rstTest = myConn.execute(strSql) DVD_COUNT = rstTest("DVD_COUNT") 'Response.Write strSql 'Response.End %>
I get that line 19 error which is the one in red.
Was the part in green just a typo?
Nikkol |
|
|
Topic |
|