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 29th, 2009, 01:10 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 ASP adding to access database

hey guys i was wondering if you help me out with this problem of mine basically am trying to add to my Access database and it keeps throwing an error and cant find out why the error is as follows

Error Type:
Microsoft JET Database Engine (0x80040E10)
No value given for one or more required parameters.
/marking/stylespages/regprocess.asp, line 20

My Code
<%@ Language ="VBScript"%>
'declare local variables
Dim Connection, addrecordset
Dim strSQL, sConnString
'declare SQL statement that will query the database
'define the connection string, specify database
'driver and the location of database
sConnString="PROVIDER=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & Server.MapPath("..\database\heas.mdb")

'create an ADO connection and recordset
Set connection = Server.CreateObject("ADODB.Connection")
Set addrecordset = Server.CreateObject("ADODB.Recordset")
connection.Mode = 3 ' adModeReadWrite
connection.Open sConnString
strSQL="SELECT staff.Staff_ID, staff.Staff_Password, staff.First_Name, staff.Staff_Last_Name, staff.Email_Address FROM staff;"
addrecordset.Open strSQL, connection, 1, 3

'allow the addition of new records to the database
addrecordset.Fields("Staff_ID") =Request.Form("Firstname")
addrecordset.Fields("Staff_Password") =Request.Form("Lastname")
addrecordset.Fields("Staff_First_Name") =Request.Form("StaffID")
addrecordset.Fields("Staff_Last_Name") =Request.Form("Password")
addrecordset.Fields("Staff_Email_Address") =Request.Form("Email")
'allow the update procedure
'close recordset and connection freeing up server resources
Set addrecordset = Nothing
Set connection = Nothing
'redirect to account confirmation of account creation

Any feedback is appreciated thanks...
in opposite world i love programming
Old May 2nd, 2009, 06:07 PM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

Which is line 20???

By my count of that code, it looks like it's *probably* this line:
addrecordset.Open strSQL, connection, 1, 3


So have you tested that SQL code in Access??

Are you sure the field names there all exist and are spelled correctly?

If that's not the culprit line 20, then which line *is* line 20??
Old May 2nd, 2009, 06:10 PM
Friend of Wrox
Join Date: Jun 2008
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts
Default Ah! Think I see it!

Look at this:
strSQL="SELECT staff.Staff_ID, staff.Staff_Password, staff.First_Name, staff.Staff_Last_Name, staff.Email_Address FROM staff;"
And then compare it to this:
addrecordset.Fields("Staff_Email_Address") =Request.Form("Email")
ONE of those is clearly wrong. I'm betting on the SELECT.

You know, there is NO REASON to use "tablename.fieldname" instead of just "fieldname" when there is only one tablename in the query.

So you could have coded that as
strSQL="SELECT Staff_ID, Staff_Password, First_Name, Staff_Last_Name, Staff_Email_Address FROM staff"
(assuming my guess as to the culprit is correct).

Similar Threads
Thread Thread Starter Forum Replies Last Post
Adding New Record to Access Database Using VB.NET TechHelp ASP.NET 1.0 and 1.1 Basics 1 September 13th, 2006 03:19 AM
Access issues with ASP and a MS Access Database rj_conceptsnrec.com Classic ASP Databases 2 May 19th, 2005 12:44 PM
avoid adding duplicate records in access/asp mikersantiago Classic ASP Basics 1 September 21st, 2004 03:24 AM
ASP to Access Database jwsoftware Classic ASP Databases 1 March 3rd, 2004 04:12 AM
Writing to access database from asp.et RaZorCleaN Access 2 October 9th, 2003 01:16 PM

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