Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases 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 October 18th, 2003, 01:29 PM
Registered User
 
Join Date: Oct 2003
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Trouble Opening Recordset

Hi all,

I'm new to asp and am trying to implement sending form data to an access database. I followed a simple tutorial which was a success, but am having trouble with a form and database of my own.

Any help would be greatly appreciated.

I get the following error in the asp code when calling the asp file from the form with user input data (if that makes sense?!?).

<%
'Dimension variables
Dim adoCon 'Holds the Database Connection Object
Dim rsAddGroup 'Holds the recordset for the new record to be added
Dim strSQL 'Holds the SQL query to query the database

'Create an ADO connection object
Set adoCon = Server.CreateObject("ADODB.Connection")


'Set an active connection to the Connection object using a DSN-less connection
adoCon.Open "DRIVER={Microsoft Access Driver (*.mdb)}; DBQ=" & Server.MapPath("ScrapMembers00.mdb")

'Create an ADO recordset object
Set rsAddGroup = Server.CreateObject("ADODB.Recordset")


'Initialise the strSQL variable with an SQL statement to query the database. THIS MUST BE ON ONE LINE
strSQL = "SELECT Groups.GroupName, Groups.GroupAddress1, Groups.GroupAddress2, Groups.GroupAddress3, Groups.Town, Groups.County, Groups.Postcode, Groups.Telephone, Groups.Fax, Groups.TypeofGroup, Groups.NoPeopleInGroup, Groups.Comment FROM Groups;"

'Set the cursor type we are using so we can navigate through the recordset
rsAddGroup.CursorType = 2

'Set the lock type so that the record is locked by ADO when it is updated
rsAddGroup.LockType = 3

'Open the recordset with the SQL query
rsAddGroup.Open strSQL, adoCon


The following error occurs on the "rsAddGroup.Open strSQL, adoCon" line above.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E10)
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 6.
/suffolk scrap store/New Member Form Application/AddRecord.asp, line 31

can anyone point me in the right direction as to what this error is about please? According to my books on asp, the syntax for recordset.open is "recordset.Open Source, ActiveConnection, CursorType, LockType, Options", so i can't see where i'm going wrong. Also, this line works for the tutorial i followed.

Thanks if you take the time to help.

Nick.

 
Old October 18th, 2003, 04:03 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi Nich,

Check out this FAQ: http://www.adopenstatic.com/faq/80040e10.asp

You may also want to check this site for a more updated connection string. The Driver / DBQ type of connection string is considered obsolete by Microsoft (although it still works).

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
Trouble Opening an Oracle Connection BrianWren Visual Basic 2005 Basics 0 August 31st, 2007 11:40 AM
Having trouble with a recordset for Login screen wayne62682 Access VBA 3 March 28th, 2006 09:28 PM
How to get # of recs without opening recordset amjad_mahmood Excel VBA 0 August 9th, 2005 05:49 AM
Opening A RecordSet Onyx2ir Access VBA 6 December 31st, 2003 12:46 AM
Problem using WHERE clause in opening Recordset johnman Classic ASP Databases 2 October 23rd, 2003 01:30 PM





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