ASP Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 



Go Back   Dev Articles Community ForumsProgrammingASP Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old December 27th, 2002, 10:35 PM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy Need Help Badly on script-HELP ASP GUROS!

Hi...
I downloaded the files to the An Article Rating System With ASP
http://www.devarticles.com/printpage.php?articleId=141
Well I set it up almost to the tee but I am getting an error on my showques.asp page.((chaged the page name)..I am including the files i recreated in hopes that one of you can help...
Some background on my misery..... I start it with an access database but i transfer the file to sql....on the tutorial it created a connection to the database which i was using until i transfer the database and put my connection. I get an error on line 43 wend.....I dont know what can be causing that error....

Last edited by laridev : December 27th, 2002 at 10:42 PM.

Reply With Quote
  #2  
Old December 27th, 2002, 10:43 PM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Here is the file......
Attached Files
File Type: zip poll2003.zip (15.3 KB, 638 views)

Reply With Quote
  #3  
Old December 28th, 2002, 09:39 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Can you tell us what the error was (including the error type and the error code). That will help us in determining the problem.

Also, you might want to type the error code into the search engine on aspfaq.com and see if the answer helps solve your problem.

Last edited by aspnewbie : December 28th, 2002 at 10:04 AM.

Reply With Quote
  #4  
Old December 28th, 2002, 10:06 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
The error I get in that line....
is as follow
error line 43....wend
this is the code
<%
rs.MoveNext
wend

function ShowRating(quesId)

const MIN_RATINGS_BEFORE_SHOW = 3



i tried addding another %> to close the wend but when i do that and i run the script it tells me i get an error on line 46 which is the funstion ShowRating(quesId)

I also have been searching for an answer myself to no avail!

Reply With Quote
  #5  
Old December 28th, 2002, 10:10 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Don't you get a microsoft generated error when you run the script? with the error code?

like:

Code:

Microsoft VBScript runtime (0x800A000D)  
Type Mismatch: <variable>

Last edited by aspnewbie : December 28th, 2002 at 10:13 AM.

Reply With Quote
  #6  
Old December 28th, 2002, 10:17 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

Yes it did unfortunately...I am at home (first time in a long time due to this prob) and only wrote down the lines where i was getting the error and what they said....

Reply With Quote
  #7  
Old December 28th, 2002, 10:19 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Too bad, cause that would provide more info! I don't have SQL server at home, so I can't reproduce the error.

You didn't get it though when you used Access right?

Reply With Quote
  #8  
Old December 28th, 2002, 12:00 PM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
okay, I found a couple of problems looking at the code and your database.

First your summary field is not currency, so you should remove the reference to formatcurrency in the following:

<b>Category:</b> <%=FormatCurrency(rs.Fields(4).Value, 2)%>

Second, numbering starts from 0 so to call the category field you should have rs.Fields(2). Summary is rs.Fields(3). You don't have a fifth field, so you can't use (rsfields(4).value).

So it should read

<b>Question:</b> <%=rs.Fields(1).Value%><br>
<b>Summary:</b> <%=rs.Fields(3).Value%><br>
<b>Category:</b> <%=rs.Fields(2).Value%>

also you remove the %> after the statement as it is not needed there.

Code:

rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly %>


Hope this helps. Let me know if you have any other errors.

Reply With Quote
  #9  
Old December 30th, 2002, 08:08 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Unhappy

Hi added the changes you suggested now I am getting this error... on my shoques.asp page....
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.
/execstaff/poll2003/showques.asp, line 12


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

Page:
GET /execstaff/poll2003/showques.asp

Time:
Monday, December 30, 2002, 9:08:26 AM

on the rate asp I get the following one..
Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/execstaff/poll2003/rate.asp, line 21, column 21


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

Page:
GET /execstaff/poll2003/rate.asp

any advice?

Reply With Quote
  #10  
Old December 30th, 2002, 08:09 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Can you post the revised files? I was able to get it to work at home, but I'm not at home now. Thanks.

Reply With Quote
  #11  
Old December 30th, 2002, 08:16 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
here they go..
Attached Files
File Type: zip poll2003.zip (15.2 KB, 619 views)

Reply With Quote
  #12  
Old December 30th, 2002, 08:24 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Okay, instead of this:

Code:

strConnect  = "PROVIDER=SQLOLEDB;UID=sa;PWD=gilgamesh;
Data Source=mhsnet_sql;Initial Catalog=Intranet;" 	
conn.Open strConnect rs.CursorLocation = adUseClient


Do this:

Code:

Conn.ConnectionString = "PROVIDER=SQLOLEDB;UID=sa;PWD=gilgamesh;Data
Source=mhsnet_sql;Initial Catalog=Intranet;" 
Conn.Open

Reply With Quote
  #13  
Old December 30th, 2002, 08:28 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
line 8 of showques.asp you have strSQL = with no statement. So you're getting an error when you attempt to open the recordset.

You probably want a select statement in there?

Reply With Quote
  #14  
Old December 30th, 2002, 08:30 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Instead of

Code:

strsql="SELECT * FROM question ORDER BY question ASC"
rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly 


try

Code:

strSQL = "SELECT * FROM question ORDER BY question ASC"
set rs = Conn.Execute(strSQL)

Reply With Quote
  #15  
Old December 30th, 2002, 08:36 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Error Type:
Microsoft VBScript compilation (0x800A0409)
Unterminated string constant
/execstaff/poll2003/showques.asp, line 6, column 68

The code so far with your suggestions up to line 23

<% dim conn, rs, strSQL, strConnect, action
action = Request.QueryString("action")
set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")
Conn.ConnectionString = "PROVIDER=SQLOLEDB;UID=sa;PWD=gilgamesh;Data
Source=mhsnet_sql;Initial Catalog=Intranet;"
Conn.Open

strSQL = "SELECT * FROM question ORDER BY question ASC"
set rs = Conn.Execute(strSQL)


while not rs.EOF
%>
<font face="Verdana" size="2" color="black">
<h2><%=rs.Fields(1).Value%></h2>
Rated: <%=ShowRating(rs.Fields(0).Value)%><br><br>
<b>Question:</b> <%=rs.Fields(1).Value%><br>
<b>Summary:</b> <%=rs.Fields(3).Value%><br>
<b>Category:</b> <%=rs.Fields(2).Value%><br>
</font>
<br>

Reply With Quote
  #16  
Old December 30th, 2002, 08:42 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Remove the hard return between data and source, so it falls on one line.

also, you don't need the variable strConnect anymore.

Reply With Quote
  #17  
Old December 30th, 2002, 09:43 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
My new error...
Error Type:
Microsoft VBScript compilation (0x800A03EA)
Syntax error
/execstaff/poll2003/showques.asp, line 61, column 3


Browser Type:
Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705)

Page:
GET /execstaff/poll2003/showques.asp

Time:
Monday, December 30, 2002, 10:44:20 AM


More information:
Microsoft Support

Reply With Quote
  #18  
Old December 30th, 2002, 09:56 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
What's line 61?

btw, you don't need this line:

rs1.ActiveConnection = "ADODB.Connection"

Reply With Quote
  #19  
Old December 30th, 2002, 10:06 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
when i took off the line...
HTTP 500.100 - Internal Server Error - ASP error
Internet Information Services

--------------------------------------------------------------------------------

Technical Information (for support personnel)

Error Type:
ADODB.Recordset (0x800A0E7D)
The connection cannot be used to perform this operation. It is either closed or invalid in this context.
/execstaff/poll2003/showques.asp, line 58

my line 56-58 are as follow
set rs1 = Server.CreateObject("ADODB.Recordset")

rs1.Open "SELECT SUM(rating), COUNT(*) FROM rating WHERE quesId = " & quesId

Reply With Quote
  #20  
Old December 30th, 2002, 10:11 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
What happens if you try instead:

Code:

set rs1 = Server.CreateObject("ADODB.Recordset")
strSQL = "SELECT SUM(rating), COUNT(*) FROM rating WHERE quesId = " & quesId
set rs = dbConn.Execute(strSQL)

Reply With Quote
  #21  
Old December 30th, 2002, 10:16 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
This...

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'dbConn'
/execstaff/poll2003/showques.asp, line 58

Reply With Quote
  #22  
Old December 30th, 2002, 10:21 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
my mistake sorry - you connection is Conn not dbConn

Reply With Quote
  #23  
Old December 30th, 2002, 10:27 AM
laridev laridev is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2002
Location: Miami
Posts: 29 laridev User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
I saw that and caught it here//Thanks now guess what...line 61

Error Type:
ADODB.Recordset (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested name or ordinal.
/execstaff/poll2003/showques.asp, line 61

my line 61 reads...61-114
is rs1 suppose to be rs now?

if rs1.Fields(1) < MIN_RATINGS_BEFORE_SHOW then
'No ratings for this Ques just yet
Response.Write "[Ques not rated yet]"
else
'This Ques has ratings, let's display the average
avgRating = rs1.Fields(0).Value / rs1.Fields(1).Value

if Instr(1, CStr(avgRating), ".") > 0 then
'The average rating is a decimal, we need to either
'round the value up/down
avgWhole = Left(CStr(avgRating), Instr(1, CStr(avgRating), ".")-1)
decPart = Mid(CStr(avgRating), Instr(1, CStr(avgRating), ".")+1, 2)

if decPart <> "" then
'Work out whether or not we have to round this
'rating up or down

if CInt(decPart) >= 5 then
decCalc = .5
else
decCalc = 0
end if

finalRating = CInt(avgWhole) + CCur(decCalc)
else
finalRating = avgRating
end if
else
finalRating = avgRating
end if

'Setup the alt text for the images
altText = "Average visitor rating of " & finalRating & " out of 5"

for i = 1 to CInt(finalRating)
Response.Write "<img alt='" & altText & "' src='rating_on.gif'>"
next

if CInt(finalRating) <> finalRating then
'This Question has a .5 rating, such as 5.5
Response.Write "<img alt='" & altText & "' src='rating_half.gif'>"

for i = CInt(finalRating)+2 to 5
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
next
else
for i = CInt(finalRating)+1 to 5
Response.Write "<img alt='" & altText & "' src='rating_off.gif'>"
next
end if
end if

end function
%>

Reply With Quote
  #24  
Old December 30th, 2002, 10:37 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Nope, don't think that's the problem. See

http://www.aspfaq.com/show.asp?id=2275

Will have to think about it.

Reply With Quote
  #25  
Old December 30th, 2002, 10:53 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
Sorry, should have been rs1

Reply With Quote
  #26  
Old December 30th, 2002, 10:57 AM
aspnewbie aspnewbie is offline
Contributing User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Apr 2002
Location: The Great White North
Posts: 361 aspnewbie User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 58 m 50 sec
Reputation Power: 17
Send a message via MSN to aspnewbie
The reason why you were getting this error

ADODB.Recordset (0x800A0BB9)
Arguments are of the wrong type, are out of acceptable range, or are in conflict with one another.

Is because you were using constants without including adovbs.

We got around this by using

Conn.Execute instead of a rs.Open.

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Need Help Badly on script-HELP ASP GUROS!


Developer Shed Advertisers and Affiliates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.

© 2003-2018 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap