Wrox Programmer Forums
|
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 software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 4th, 2009, 06:43 PM
Authorized User
 
Join Date: Nov 2007
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
 
Old April 5th, 2009, 01:04 AM
Friend of Wrox
 
Join Date: Jun 2008
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.





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





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.