Programming Tools
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingProgramming Tools

Closed Thread
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:
AT&T devCentral & BlackBerry(r) Webcast Series: BlackBerry and GPS -Build Location Awareness into your BlackBerry Applications, July 10th-1:00PM EST. Register Today!
  #1  
Old December 27th, 2002, 01:23 PM
laridev laridev is offline
Junior Member
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
cannot get script to work..

Hi,

I need to get this working but I am having the hardest of times. I recreated the An Ariticle Rating System script and here is my problem.
I named my table questions and created a colum as the test database included in the files. When I try running the questions.asp page i cant see any of the questions and when I click on rate it...it is asking me to open the rate.asp page. Can someone help I also get the following error...
Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80004005)
[Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified
/execstaff/poll2003/showques.asp, line 9
since i am testing in my server i copy the file that all the pages are place and create a connection from there...I would appreciate your help....PLEASE!

here is my code....
<%

dim conn
dim rs

set conn = Server.CreateObject("ADODB.Connection")
set rs = Server.CreateObject("ADODB.Recordset")

conn.Open "DSN=questions"

rs.ActiveConnection = conn
rs.Open "SELECT * FROM questions ORDER BY title ASC"

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(2).Value%><br>
<b>Summary:</b> <%=rs.Fields(3).Value%><br>
<b>Category:</b> <%=FormatCurrency(rs.Fields(4).Value, 2)%><br>
</font>
<br>
<form name="frmRate<%=rs.Fields(0).value%>" action="rate.asp" method="post">
<input type="hidden" name="quesId" value="<%=rs.Fields(0).value%>">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
<tr>
<td bgcolor="black">
<font face="Verdana" size="1" color="white">

<%
for i = 1 to 10
Response.Write "&nbsp;" & i & " <input name='rating' type='radio' value='" & i & "'> "
next
%>

</font>
<input type="submit" value="Rate It!">
</td>
</tr>
</table>
</form>
<hr size="1" color="#08496B" NOSHADE>

<%
rs.MoveNext
wend

function ShowRating(quesId)

const MIN_RATINGS_BEFORE_SHOW = 3

dim rs1
dim avgRating
dim avgWhole
dim decPart
dim decCalc
dim finalRating
dim altText

set rs1 = Server.CreateObject("ADODB.Recordset")

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

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

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
  #2  
Old December 27th, 2002, 11:13 PM
FrankieShakes FrankieShakes is offline
Frank The Tank!
Dev Articles Beginner (1000 - 1499 posts)
 
Join Date: Jun 2002
Location: Toronto, Canada
Posts: 1,246 FrankieShakes User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Send a message via ICQ to FrankieShakes Send a message via MSN to FrankieShakes
Duplicate Thread... Refer to original post
__________________
____________________________________________
Developer Shed Weekly Writer | DevArticles Forum Moderator
Build Your Own KlipFolio Klip With PHP
FrankManno.com - Under Construction
Design Interactive Group - Under Construction

Reply With Quote
Closed Thread

Viewing: Dev Articles Community ForumsProgrammingProgramming Tools > cannot get script to work..


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 | 
  
 

Iron Speed




© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 2 hosted by Hostway