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.
|