Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > ASP 3 Classic ASP Active Server Pages 3.0 > BOOK: Beginning ASP 3.0
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning ASP 3.0 section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old April 4th, 2009, 06:43 PM
Authorized User
 
Join Date: Nov 2007
Location: Grimsby, North East Lincolnshire, United Kingdom.
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to chris1012
Default mysql 3.5 asp problem won't update database

hey guys i was wondering if you could help me with this piece of code i can't see whats wrong with it personally its telling me ..........

Error Type:
Microsoft VBScript runtime (0x800A01A8)
Object required: 'DRIVER={MySQL ODBC 3'
/marking/stylespages/regprocess.asp, line 8


am running mysql and asp strange and tricky combination i know but i thinks it worth a challenge i've got the Mysql 3.5 odbc driver installed i can't see whats wrong personally should of stayed with php:P

thanks in advance

Chris....

<%@ Language ="VBScript"%>
<%
'declare local variables
Dim sConnection, objConn, addrecordset, strSQ
sConnection = "DRIVER={MySQL ODBC 3.51 Driver}; SERVER=localhost; DATABASE=heas; UID=root;PASSWORD=admin; OPTION=3"
Set objConn = Server.CreateObject("ADODB.Connection")
Set addrecordset = Server.CreateObject("ADODB.Recordset")
sConnection.Mode = 3 ' adModeReadWrite
objConn.Open sConnection
strSQL="SELECT staff.staff_id, staff.staff_password, staff.staff_first_name, staff.staff_last_name, staff.staff_email_address FROM staff;"
addrecordset.Open strSQL, sConnection, 1, 3

'allow the addition of new records to the database
addrecordset.AddNew
addrecordset.Fields("Staff_ID") =Request.Form("username")
addrecordset.Fields("Staff_password") =Request.Form("password")
addrecordset.Fields("Staff_first_name") =Request.Form("fname")
addrecordset.Fields("staff_last_name") =Request.Form("ltname")
addrecordset.Fields("staff_email_address") =Request.Form("email")
'allow the update procedure
addrecordset.Update
'close recordset and connection freeing up server resources
addrecordset.Close
Set addrecordset = Nothing
Set sConnection = Nothing
'redirect to account confirmation of account creation
Response.Redirect"acreated.asp"
%>
__________________
in opposite world i love programming
  #2 (permalink)  
Old April 5th, 2009, 01:04 AM
Friend of Wrox
 
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default

You CREATE the connection object. You open it.

And then YOU IGNORE IT!

WHY did you code
Code:
addrecordset.Open strSQL, sConnection, 1, 3
instead of
Code:
addrecordset.Open strSQL, objConn, 1, 3
I'm not sure that's the problem, but it sure looks like it is.

But now I need to warn you: I do *NOT* think you will be able to use ADODB.Recordset.AddNew with that old MySQL ODBC driver. I believe it doesn't support ADO-based inserts or updates. I think you may have to resort to using a SQL INSERT command. Not sure on that. Things could have changed in the 6 or so years since I used MySQL with ASP. Give it a try, but if it doesn't work be prepared to use SQL INSERT instead.
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
MySql Database Problem surongama JSP Basics 0 October 16th, 2006 08:01 AM
asp-mysql update error chidomen Classic ASP Databases 1 June 15th, 2005 05:29 PM
unable to update MySQL database with ASP don baroo Classic ASP Databases 7 November 22nd, 2004 01:22 PM
MySql Database with ASP RobinR Classic ASP Databases 0 February 23rd, 2004 09:07 AM
Update asp-access to mysql karib Classic ASP Databases 3 November 30th, 2003 01:44 PM



All times are GMT -4. The time now is 08:30 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.