Re: Updating database pages (and not adding a new record)

  •  10-19-2004, 3:42 PM

    Re: Updating database pages (and not adding a new record)

            I've replaced this code with the code you provided. I also made a page that passes an ID to it:   <a href="page.asp?ID=2">link</a>

    But it still doesn't work. What am I doing wrong??
     
     
      if request("action")="save" then
               TitleField  = Request.Form("TitleField")
               MessageField = Request.Form("Editor1_HTMLContent")      
               
               sql="select TitleField,MessageField from test"
               set rs=server.createobject("adodb.recordset")
               rs.open sql,conn,3,3
               
               rs.addnew
               rs("TitleField") = TitleField
               rs("MessageField") = MessageField
               rs.update
               
               response.write "<font size=5 color=red>Kari, your message has been added</font>"
               response.write "<br>"
               rs.close
               set rs = nothing
              else
               MySQL="select top 1 * from test order by id DESC"
               set rs2=conn.execute(MySQL)
               if not rs2.eof then
                TitleField  = rs2("TitleField")
                MessageField  = rs2("MessageField")
                rs2.close
                set rs2=nothing
               end if
              end if 
View Complete Thread