Forums

ASP

This topic is locked

asp-ado addnew error

Posted 21 Aug 2005 13:28:26
1
has voted
21 Aug 2005 13:28:26 peter mill posted:
hey
I am tring to add data to a recordset.
but i am getting the following error.

Microsoft OLE DB Provider for ODBC Drivers (0x80040E21)
Multiple-step OLE DB operation generated errors.
Check each OLE DB status value, if available. No work was done.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
<!--#include file="Connections/MyDatabase.asp" -->
<%
Dim NewUser
Dim NewUser_numRows
Set NewUser = Server.CreateObject("ADODB.Recordset"
NewUser.ActiveConnection = MM_MyDatabase_STRING
NewUser.Source = "SELECT * FROM Users"
NewUser.CursorType = 3
NewUser.CursorLocation = 2
NewUser.LockType = 3
NewUser.Open()
'NewUser_numRows = 0
%>
<%
Dim conemail, NewID, NewFN, NewLN, NewUN, NewPass, NewEmail
If Request("txtUserName" <> "" and Request("txtPassword2" <> "" and Request("txtPassword1" <> "" and Request("txtemail1" <> "" and Request("txtemail2" <> "" and Request("txtLName" <> "" and Request("txtfname" <> "" and Request("txtPassword1" = Request("txtPassword2" and Request("txtemail1" = Request("txtemail2" then
session("MM_Password" = request.form("txtPassword1"
' ::: Setup the Variables
NewID = NewUser.Fields.Item("UserID".value +1
NewFN = Request("txtFName"
NewLN = Request("txtLName"
NewUN = Request("txtUserName"
newPass = Request("txtPassword1"
NewEmail = Request("txtEmail1"
' ::: Find the Last Record ID and Add One
NewUser.MoveLast
' ::: Add the new data
NewUser.AddNew
NewUser("UserID" = NewID
'NewUser.Fields.Item("FName" = NewFN
'NewUser.Fields.Item("LName" = NewLN
'NewUser.Fields.Item("UserName" = NewUN
'NewUser.Fields.Item("Password" = NewPass
'NewUser.Fields.Item("EmailAddress" = NewEmail
'Response.write("NewID: " & NewID)
'Response.write("FN: " & NewFN)
'Response.write("LN: " & NewLN)
'Response.write("Pass: " & NewPass)
'Response.write("Username: " & NewUN)
'Response.write("Email: " & NewEmail)
NewUser.Update
NewUser.Close
'response.redirect "UserLogin.asp"
' ::: No First name :::

This is only a snippet of the code. It looks right to me, But i might of missed something.
The recordedset is set to Cursor: Static and Lock Type: optimistic.

I know that i only have one variable to add (at the moment), NewUser("UserID" .

but it still produces the same error.
Any help is appreciated.

thanks

Thunderchild

Reply to this topic