|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
error when i launch my asp page.
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 7 Browser Type: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.0; .NET CLR 1.0.3705) Page: GET /execstaff/poll2003/showques.asp is there someone out there that can help me on this script... PLEASE!!! ![]() |
|
#2
|
|||
|
|||
|
Have you set up a DSN or do u use a DSN-less connection?
It would be more useful for us if you put up the script u use, so we can help you. But as I look at the error, it seems u are using a very wrong connection-string. |
|
#3
|
|||
|
|||
|
Ok here it is all of it...Please help me...and yes I used a dns connection....
|
|
#4
|
|||
|
|||
|
ok here is another problem i am getting
Error Type: Microsoft VBScript compilation (0x800A0400) Expected statement /execstaff/poll2003/showques.asp, line 46 my line 46 reads =wend |
|
#5
|
|||
|
|||
|
I think I've found your problem.
You are using a connection string for an Sql-server database, while you are using an Access-database. If you use a DSN connection, try this as a connection-string: strConnect = "DSN=yourdsn " where you replace yourdsn with your connection-name. I hope this works. Good luck |
|
#6
|
|||
|
|||
|
I added the following and I am still getting the error. I dont know what can be....
<% dim conn, rs, strSQL, strConnect, action action = Request.QueryString("action") set conn = Server.CreateObject("ADODB.Connection") set rs = Server.CreateObject("ADODB.Recordset") strConnect = "PROVIDER=SQLOLEDB;UID=sa;PWD=gilgamesh;Data Source=mhsnet_sql;Initial Catalog=Intranet;" strSQL = "Select * from question order by question;" conn.Open strConnect rs.CursorLocation = adUseClient rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly %> 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 5 Response.Write " " & 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 = "ADODB.Connection" 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 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 %> |
|
#7
|
|||
|
|||
|
Remove the %> at the end of this line
rs.Open strSQL,conn,adOpenForwardOnly,adLockReadOnly %> |
![]() |
| Viewing: Dev Articles Community Forums > Programming > Programming Tools > error when i launch my asp page. |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|