Photo Gallery Member List Search Calendars FAQ Ticket List Log Out


how do you add a record in asp/VBscript

 
Logged in as: Guest
arrSession:exec spGetSession 2,3,25168
 Active Users: There are 0 members and 0 guests.
 Users viewing this topic: none
 

 

 
  
  Printable Version
All Forums >> [Scripting] >> ASP >> how do you add a record in asp/VBscript
  Do you like VisualBasicScript.com? Link to us and help spread the word about our forum. Thanks!
Page: [1]
Login
Message << Older Topic   Newer Topic >>
 how do you add a record in asp/VBscript - 8/21/2005 12:36:32 PM   
  thunderchild

 

Posts: 4
Score: 0
Joined: 8/16/2005
Status: offline
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
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 Cursor is  Static and Lock Type is optimistic.
I know that i only have one variable to add (at the moment), NewUser("UserID") , I have more to add once i get this one working.
but it still produces the same error.
Any help is appreciated.

thanks
Thunderchild
 
 
Post #: 1
 
 
 
  

If you found our site useful please link to us <a href="http://www.visualbasicscript.com">VisualBasicScript.com</a>.
All Forums >> [Scripting] >> ASP >> how do you add a record in asp/VBscript Page: [1]
Jump to:





New Messages No New Messages
Hot Topic w/ New Messages Hot Topic w/o New Messages
Locked w/ New Messages Locked w/o New Messages
 Post New Thread
 Reply to Message
 Post New Poll
 Submit Vote
 Delete My Own Post
 Delete My Own Thread
 Rate Posts