|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
I'm trying to use the article rating system on this site, which was written by Annette Tenison. I've made quite a few modifications to it to suit my requirements, especially since the article explains how the script works with a DSN connection, and I'm using a DSN-less one.
The problem is in the rate.asp page, which takes the variables from the articles.asp page entered by the user, and writes them to the database. I'm facing some problems with this. The code snippet (line 64 of the page) I'm talking about is: conn.Execute "INSERT INTO ratings(rating, ip, cdId) VALUES(" & rating & ", '" & visitorIP & "', " & cdId & ")" While using this, the asp page does not send the data properly to the db, and I don't think the db recieves it either. I get the following error. Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: 'driver={Microsoft Ac' /wwwroot/articles/rate.asp, line 64 I tried using a DSN-less connection and: sql="insert into ratings SET rating='" & rating & "',ip='" & visitorIP & "',id='" & id & "' where ratingid=" & request("ratingid") and sql="update ratings SET rating='" & rating & "',ip='" & visitorIP & "',id='" & id & "' where ratingid=" & request("ratingid") But none of them seem to work. Help? Last edited by Nischint : March 25th, 2003 at 10:20 AM. |
|
#2
|
|||
|
|||
|
Attached the asp files I'm using.
|
|
#3
|
|||
|
|||
|
If you comment that line out, do the articles show up?
I notice a couple of lines above you have: rs.open "select count(*) from ratings where ip='" & visitorIP & "' and id=" & id without creating a recordset object try using your MakeRS function to execute this query or strSQL = "select count(*) from ratings where ip='" & visitorIP & "' and id=" & id set rs = Server.CreateObject("ADODB.Recordset") rs.Open strSQL, cn, 1, 3 I assume that you set cn as your Connection object in your MakeDBConnection function? |
|
#4
|
|||
|
|||
|
Hi aspnewbie,
cn is my connection object in the makedb function and I tried using: strSQL = "select count(*) from ratings where ip='" & visitorIP & "' and id=" & id Although the page processed properly, the record was not added to the database. I commented that line out, and the articles still showed up, and the page processed properly. But the record, again, was not added to the database. I added a rating into the database manually, and everything works fine, showing the graphical display. But when I try to rate it using the rate.asp page, it just doesn't add the record and again gives me the same error: Error Type: Microsoft VBScript runtime (0x800A01A8) Object required: 'driver={Microsoft Ac' /wwwroot/articles/rate.asp, line 64 Any solutions? |
|
#5
|
||||
|
||||
|
That error usually means there's something wrong with your connection string, or the method you are using to connect to the db. Double check your connection and recordset object creation lines.
|
|
#6
|
|||
|
|||
|
This little script has given me enough of a headache so I've given up on customizing it. I'm using it as is, from http://www.devarticles.com/art/1/141/, which is Annette Tenison's original article. She's used a DSN connection. I'm using a DSN less one. As a result, this one line of code:
conn.Execute "INSERT INTO ratings(rating, ip, cdId) VALUES(" & rating & ", '" & visitorIP & "', " & cdId & ")" causes all the errors: Error Type:Microsoft VBScript runtime (0x800A01A8) Object required: 'driver={Microsoft Ac' Now call me stupid or even a newbie, but I don't know how to convert that one line that a dsnless connection will accept. Please can someone help me out and post the DSNless code for the conn.execute function. |
|
#7
|
|||
|
|||
|
Code:
Dim cn ' CONN object
set cn = Server.CreateObject ("ADODB.Connection")
cn.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;"_
& "Data Source=C:\pathtoyourdatabase\nameofdatabase.mdb "
cn.Open
(Assuming your jet engine is 4.0) Here's a list of other the various connection strings depending on your db. http://www.aspfaq.com/show.asp?id=2126 If this doesn't work just search this forum, as this question has been asked alot! |
|
#8
|
||||
|
||||
|
4guysfromrolla.com have serveral articles on connecting to a database, using the various methods available (DSN, DNS-less, OLEDB). This article discusses OLEDB connections, and shows why they are the fastest way to connect to a database.
They cover Access & SQLServer DB's |
![]() |
| Viewing: Dev Articles Community Forums > Programming > ASP Development > Article rating script problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|