Results 1 to 3 of 3

Thread: AddNew?

  1. #1
    Join Date
    Dec 1969

    Default AddNew?

    I am getting an error that has plagued me for 6 hours today.. could I get a hand? Thank you..<BR>Here is the code..<BR><BR>The error occurs on the line that reads oRS.AddNew<BR><BR>&#060;%<BR>&#039 The following code example demonstrates the use of<BR>&#039 the Form collection of the Request object to retrieve<BR>&#039 the values entered by the client into an HTML form.<BR>Dim dbname1<BR>Dim dbname2<BR>Dim dbemail<BR>Dim maillist<BR>Dim friendname<BR>Dim friendemail<BR>Dim bodytext<BR>&#039 Retrieve the information from the form&#039s text boxes.<BR>dbname1= Request.Form("FirstName")<BR>dbname2= Request.Form("LastName")<BR>dbemail= Request.Form("YourEmail")<BR>maillist= Request.Form("Newsletter")<BR>friendname= Request.Form("FriendsName")<BR>friendemail= Request.Form("FriendsEmail")<BR>bodytext= Request.Form("Body")<BR>Dim objCDOMail<BR><BR>Set objCDOMail = Server.CreateObject("CDONTS.NewMail")<BR>objCDOMai l.From = dbemail<BR>objCDOMail.To = friendemail<BR>objCDOMail.Bcc = ""<BR>objCDOMail.Subject = "You&#039ve Got To See this..."<BR>objCDOMail.Body = bodytext<BR>&#039 Send the message!<BR>objCDOMail.Send<BR>Set objCDOMail = Nothing<BR>%&#062;<BR>&#060;%<BR>&#039Add email address and names to database<BR>Dim cn<BR>Dim oRS<BR>Set cn = Server.CreateObject("ADODB.Connection")<BR>Set oRS = Server.CreateObject("ADODB.Recordset")<BR>cn.Open "DSN=DB;UID=username;Password=password;"<BR>oRS.Ac tiveConnection = cn<BR>oRS.Open "tblContacts"<BR>oRS.AddNew<BR>oRS("fldEmail") = dbemail<BR>oRS("fldFirstName") = dbname1<BR>oRS("fldLastName") = dbname2<BR>oRS.Update<BR>oRS.Close<BR>cn.Close<BR> Set oRS = Nothing<BR>Set cn = Nothing<BR>%&#062;<BR>&#060;%<BR>Response.Redirect "/commerce/tellafriend.asp"<BR>%&#062;

  2. #2
    Vipul Desai Guest

    Default RE: AddNew?

    Daniel, Make sure that in your recordset object, you are using the adOpenDynamic, and adPessimisticLock options. <BR> 3 = adOpenDynamic<BR> 3 = adOpenDynamic<BR><BR> "SqlStr",3,3<BR><BR>

  3. #3
    Join Date
    Dec 1969

    Default RE: AddNew?

    You are missing:<BR>cursorType and lockType: <BR><BR>set conn=server.createobject("adodb.Recordset")<BR>con n.ActiveConnection = "login"<BR> conn.Source = "Projects"<BR> conn.CursorType = 3 <BR>conn.LockType = 2 <BR>conn.Open<BR> conn.AddNew<BR>conn.Fields("UserName") = project<BR>conn.Fields("...") = logo<BR> conn.Fields("..") =subit<BR>conn.Fields("..") = viewit<BR>conn.Fields("..") = downit <BR>conn.Fields("..") = wit <BR>conn.Fields("..") = lastit<BR>conn.Fields("..") = clob<BR> conn. Update%&#062;

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts