Re: Updating info to existing pages

  •  10-22-2004, 1:59 PM

    Re: Updating info to existing pages

    I haven't changed anything in your database. I've added code you posted to my page.

    This is what I want to do. I want to be able to call a page by using an ID (a simple link that will contain an UPR just like the one below):
     
     
    This will call a page 5 to be edited (an example).
     
    Once the page displays, I will make chage to it, and save it (so the code should make change to that particular page, and does not create a new record).
     
    I also need to be able to have a page that will display what is in the database (in this case page with an ID=5)
     
    And that is it.
     
    This is the original code:
     
             
             <%
      
              dim conn
              dim connstr
              Set conn = Server.CreateObject("ADODB.Connection")
              connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("test.mdb")
              conn.Open connstr
              
              dim content
              
              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=darkred>Message 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 
             %>
             .
             .
             .
             .
             .
             .
             .
               <%
                 Dim editor
                 Set editor = New CuteEditor
         
                 editor.ID = "Editor1"
                 editor.Text = MessageField
                 editor.FilesPath = "editor_files"
                 editor.ImageGalleryPath = "/uploads"
                 editor.MaxImageSize = 50
                 'editor.AutoConfigure = "EnableAll"
                 'editor.Template= "Bold,Italic,Underline"
                 'editor.StyleSheetPath = "/grey2.css"
                 'editor.Width = 740
                 'editor.Height = 300
                 editor.Draw()
       
                 ' Request.Form("Editor1_HTMLContent") access from other page
      
                %>

     
     
    This is what you had in your previous posts: (this is the code for - http://www.hostlanedomains.com/text_edit/todatabase_final.asp?ID=5)
     
                      <%
      
              dim conn
              dim connstr
              Set conn = Server.CreateObject("ADODB.Connection")
              connstr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("test.mdb")
              conn.Open connstr
              
              dim content
              
    ID = Request("ID")
    If ID <> "" then
        sql="select TitleField,MessageField from test where id=" & Request.Querystring("id")
        'sql="select TitleField,MessageField from test where id="Request.Querystring("id")
        set rs=server.createobject("adodb.recordset")
        rs.open sql,conn,3,3         
        rs("TitleField") = TitleField
        rs("MessageField") = MessageField
        rs.update
        rs.Close
     response.write(request.querystring("id"))
        Set rs = nothing
    End If
     
             %>
             .
             .
             .
             .
             .
             .
             .
             .
                <%         
                 
                 Dim editor
                 Set editor = New CuteEditor
         
                 editor.ID = "Editor1"
                 editor.Text = MessageField
                 editor.FilesPath = "editor_files"
                 editor.ImageGalleryPath = "/uploads"
                 editor.MaxImageSize = 50
                 editor.AutoConfigure = "fscc"
                 'editor.Template= "Bold,Italic,Underline"
                 'editor.StyleSheetPath = "/grey2.css"
                 editor.Width = 490
                 editor.Height = 300
                 editor.Draw()
       
                 ' Request.Form("Editor1_HTMLContent") access from other page
      
                %>
     
     
    Let me know if you need anything else. Thank you.
     
     
     
View Complete Thread