Forums
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:
heyI 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"











session("MM_Password"


' ::: Setup the Variables
NewID = NewUser.Fields.Item("UserID"

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"

'NewUser.Fields.Item("FName"

'NewUser.Fields.Item("LName"

'NewUser.Fields.Item("UserName"

'NewUser.Fields.Item("Password"

'NewUser.Fields.Item("EmailAddress"

'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