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 March 25th, 2003, 08:44 AM
Nischint Nischint is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 Nischint User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Exclamation Article rating script problem

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.

Reply With Quote
  #2  
Old March 25th, 2003, 10:29 AM
Nischint Nischint is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 Nischint User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Attached the asp files I'm using.
Attached Files
File Type: zip articlerate.zip (11.0 KB, 457 views)

Reply With Quote
  #3  
Old March 25th, 2003, 07:48 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: 8
Send a message via MSN to aspnewbie
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?

Reply With Quote
  #4  
Old March 25th, 2003, 09:58 PM
Nischint Nischint is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 Nischint User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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?

Reply With Quote
  #5  
Old March 26th, 2003, 06:59 AM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 9 m 52 sec
Reputation Power: 10
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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.

Reply With Quote
  #6  
Old March 26th, 2003, 09:01 AM
Nischint Nischint is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 4 Nischint User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
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.

Reply With Quote
  #7  
Old March 26th, 2003, 03:39 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: 8
Send a message via MSN to aspnewbie
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!

Reply With Quote
  #8  
Old March 26th, 2003, 06:11 PM
stumpy's Avatar
stumpy stumpy is offline
May contain nuts.
Dev Articles Regular (2000 - 2499 posts)
 
Join Date: Aug 2002
Location: Sydney, AU
Posts: 2,058 stumpy User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 5 h 9 m 52 sec
Reputation Power: 10
Send a message via ICQ to stumpy Send a message via MSN to stumpy
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

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingASP Development > Article rating script problem


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




 Free IT White Papers!
 
How to Present Effectively Online
This white paper offers practical and actionable advice on the key steps that any presenter should consider as they plan and execute a Webinar or online meeting.

Request Your Free Technology Downloads!
 
Open Source Security Myths
Open Source Software (OSS) is computer software whose source code is available to the general public with relaxed or non-existent intellectual property restrictions (or arrangement such as the public domain), and is usually developed with the input of many contributors.

Request Your Free Technology Downloads!
 
Power and Cooling Capacity Management for Data Centers
This paper describes the principles for achieving power and cooling capacity management.

Request Your Free Technology Downloads!
 
Scalable, Fault-Tolerant NAS for Oracle - The Next Generation
For several years NAS has been evolving as a storage alternative for Oracle databases, and for good reason: NAS is quite often the simplest, most cost-effective storage approach for Oracle. Learn about the benefits that HP's approach to scalable NAS brings to Oracle environments in this comprehensive white paper.

Request Your Free Technology Downloads!
 
Understanding Web Application Security Challenges
This white paper discusses many common threats and preventive measures for Web application security, and explains what you can do to help protect your organization.

Request Your Free Technology Downloads!
 

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




© 2003-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
For more Enterprise Application Development news, visit eWeek