Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Community Forums
 Code Support: ASP (Non-Forum Related)
 Counting .... uhh.. someone help please
 New Topic  Topic Locked
 Printer Friendly
Previous Page | Next Page
Author Previous Topic Topic Next Topic
Page: of 4

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  14:32:58  Show Profile
quote:

I was gonna tell you to try BANANA instead.

Nikkol



Thanks but that didn't work either j/k



http://www.frutzle.com

Snitz Exchange | Do's and Dont's
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  14:36:23  Show Profile
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  14:42:14  Show Profile
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
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  15:43:07  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  15:47:38  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  15:52:01  Show Profile
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  16:38:11  Show Profile
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  16:45:26  Show Profile
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  16:48:06  Show Profile
Try this instead:

strSql = "SELECT COUNT(*) AS DVD_COUNT FROM " & strTablePrefix & "DVD"

Nikkol
Go to Top of Page

Doug G
Support Moderator

USA
6493 Posts

Posted - 14 March 2002 :  16:51:10  Show Profile
You could try using COUNT(*) instead of COUNT(ID). Or, COUNT([ID]) is another option.

======
Doug G
======
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  16:53:26  Show Profile
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  17:01:21  Show Profile
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
Go to Top of Page

Gremlin
General Help Moderator

New Zealand
7528 Posts

Posted - 14 March 2002 :  17:18:25  Show Profile  Visit Gremlin's Homepage
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
Go to Top of Page

Roland
Advanced Member

Netherlands
9335 Posts

Posted - 14 March 2002 :  17:25:10  Show Profile
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
Go to Top of Page

Nikkol
Forum Moderator

USA
6907 Posts

Posted - 14 March 2002 :  17:31:24  Show Profile
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
Go to Top of Page
Page: of 4 Previous Topic Topic Next Topic  
Previous Page | Next Page
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.3 seconds. Powered By: Snitz Forums 2000 Version 3.4.07