Updating Records ( Dreamweaver MX 2004, ASP & Access )

Ask a Question related to Dreamweaver AppDev, Design and Development.

  1. #1

    Default Updating Records ( Dreamweaver MX 2004, ASP & Access )

    hi there, I'm trying to update a record from a database but I don?t know how to
    do this from the new version because the behavior window it's different, I'm
    choosing the record to be updated from a list of records, linking the record
    with the ID with:
    modificaroaxaca.asp?ID=<%=(Recordset1.Fields.Item( "ID").Value)%>, then, in the
    next ASP document I've all the data to be updated but the Update record
    behavior it's different from other versions, I don't know what to do with for
    example Unique Key Column thing, and my document it's not updating nothing just
    click in the update record button and goes to the same document without go to
    my checkdata page ( after update go to... ), any help?

    Thanks

    Atmosfera Guest

  2. Similar Questions and Discussions

    1. Updating Multi records
      Is there any way to update muliple records in one database table in one go?
    2. Updating data with Dreamweaver MX 2004
      :light; Date data types won't update to my DB (Oracle 9i) from a form page (ASP) with a Javascript calendar date picker. This works fine with an...
    3. Updating Access 2000 Records in .NET
      Hi, I need some help. I have a on button click event that goes through a survey and reads the items they choose and then updates the current...
    4. Updating records when using a subform
      On Wed, 23 Jul 2003 12:39:22 -0700, "JohnL" <johnlaidlaw@nospamtalk21.com> wrote: <ftp.ipswitch.com>
    5. Updating Multiple Records
      I have a table in a database that contains all my photos. The fields are like Name, SRC, GalleryName, DateAdded, SpecialStyle. The only one you may...
  3. #2

    Default Re: Updating Records ( Dreamweaver MX 2004, ASP & Access )

    Different from DMX 6.0? A little .. but works the same way. Make sure you
    are binding the columns correctly in the Update behavior to the text fields
    in the update form. If that doesn't help you .. post your code back here.


    --
    Nancy Gill
    Team Macromedia Volunteer for Dreamweaver MX/UltraDev
    [url]http://www.macromedia.com/go/team/[/url]
    Co-Author: Dreamweaver MX: Instant Troubleshooter (August, 2003)
    Technical Editor: DMX 2004: The Complete Reference, DMX 2004: A Beginner's
    Guide, Mastering Macromedia Contribute
    Technical Reviewer: Dynamic Dreamweaver MX/DMX: Advanced PHP Web Development

    "Atmosfera" <webforumsuser@macromedia.com> wrote in message
    news:d59m7f$4a1$1@forums.macromedia.com...
    > hi there, I'm trying to update a record from a database but I don?t know
    how to
    > do this from the new version because the behavior window it's different,
    I'm
    > choosing the record to be updated from a list of records, linking the
    record
    > with the ID with:
    > modificaroaxaca.asp?ID=<%=(Recordset1.Fields.Item( "ID").Value)%>, then, in
    the
    > next ASP document I've all the data to be updated but the Update record
    > behavior it's different from other versions, I don't know what to do with
    for
    > example Unique Key Column thing, and my document it's not updating nothing
    just
    > click in the update record button and goes to the same document without go
    to
    > my checkdata page ( after update go to... ), any help?
    >
    > Thanks
    >

    Nancy Gill Guest

  4. #3

    Default Re: Updating Records ( Dreamweaver MX 2004, ASP & Access)

    Hi nancy, thanks a lot, i'll post the code tonight

    thanks!


    Arturo
    Atmosfera Guest

  5. #4

    Default Re: Updating Records ( Dreamweaver MX 2004, ASP & Access)

    hi Nancy, here's my code

    thanks!!

    <%@LANGUAGE="VBSCRIPT" CODEPAGE="1252"%>
    <!--#include file="../Connections/CinemaxSite.asp" -->
    <%
    ' *** Edit Operations: declare variables

    Dim MM_editAction
    Dim MM_abortEdit
    Dim MM_editQuery
    Dim MM_editCmd

    Dim MM_editConnection
    Dim MM_editTable
    Dim MM_editRedirectUrl
    Dim MM_editColumn
    Dim MM_recordId

    Dim MM_fieldsStr
    Dim MM_columnsStr
    Dim MM_fields
    Dim MM_columns
    Dim MM_typeArray
    Dim MM_formVal
    Dim MM_delim
    Dim MM_altVal
    Dim MM_emptyVal
    Dim MM_i

    MM_editAction = CStr(Request.ServerVariables("SCRIPT_NAME"))
    If (Request.QueryString <> "") Then
    MM_editAction = MM_editAction & "?" & Server.HTMLEncode(Request.QueryString)
    End If

    ' boolean to abort record edit
    MM_abortEdit = false

    ' query string to execute
    MM_editQuery = ""
    %>
    <%
    ' *** Update Record: set variables

    If (CStr(Request("MM_update")) = "nuevacartelera" And
    CStr(Request("MM_recordId")) <> "") Then

    MM_editConnection = MM_CinemaxSite_STRING
    MM_editTable = "Durango"
    MM_editColumn = "ID"
    MM_recordId = "" + Request.Form("MM_recordId") + ""
    MM_editRedirectUrl = "checkdata.asp"
    MM_fieldsStr =
    "NombreSpanish|value|NombreEnglish|value|Clasifica cion|value|Pais|value|FechaRel
    ease|value|Director|value|Reparto|value|SitioOfici al|value|Horarios|value|Sinops
    is|value"
    MM_columnsStr =
    "NombreSpanish|',none,''|NombreEnglish|',none,''|C lasificacion|',none,''|Pais|',
    none,''|FechaRelease|',none,''|Director|',none,''| Reparto|',none,''|SitioOficial
    |',none,''|Horarios|',none,''|Sinopsis|',none,''"

    ' create the MM_fields and MM_columns arrays
    MM_fields = Split(MM_fieldsStr, "|")
    MM_columns = Split(MM_columnsStr, "|")

    ' set the form values
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_fields(MM_i+1) = CStr(Request.Form(MM_fields(MM_i)))
    Next

    ' append the query string to the redirect URL
    If (MM_editRedirectUrl <> "" And Request.QueryString <> "") Then
    If (InStr(1, MM_editRedirectUrl, "?", vbTextCompare) = 0 And
    Request.QueryString <> "") Then
    MM_editRedirectUrl = MM_editRedirectUrl & "?" & Request.QueryString
    Else
    MM_editRedirectUrl = MM_editRedirectUrl & "&" & Request.QueryString
    End If
    End If

    End If
    %>
    <%
    ' *** Update Record: construct a sql update statement and execute it

    If (CStr(Request("MM_update")) <> "" And CStr(Request("MM_recordId")) <> "")
    Then

    ' create the sql update statement
    MM_editQuery = "update " & MM_editTable & " set "
    For MM_i = LBound(MM_fields) To UBound(MM_fields) Step 2
    MM_formVal = MM_fields(MM_i+1)
    MM_typeArray = Split(MM_columns(MM_i+1),",")
    MM_delim = MM_typeArray(0)
    If (MM_delim = "none") Then MM_delim = ""
    MM_altVal = MM_typeArray(1)
    If (MM_altVal = "none") Then MM_altVal = ""
    MM_emptyVal = MM_typeArray(2)
    If (MM_emptyVal = "none") Then MM_emptyVal = ""
    If (MM_formVal = "") Then
    MM_formVal = MM_emptyVal
    Else
    If (MM_altVal <> "") Then
    MM_formVal = MM_altVal
    ElseIf (MM_delim = "'") Then ' escape quotes
    MM_formVal = "'" & Replace(MM_formVal,"'","''") & "'"
    Else
    MM_formVal = MM_delim + MM_formVal + MM_delim
    End If
    End If
    If (MM_i <> LBound(MM_fields)) Then
    MM_editQuery = MM_editQuery & ","
    End If
    MM_editQuery = MM_editQuery & MM_columns(MM_i) & " = " & MM_formVal
    Next
    MM_editQuery = MM_editQuery & " where " & MM_editColumn & " = " & MM_recordId

    If (Not MM_abortEdit) Then
    ' execute the update
    Set MM_editCmd = Server.CreateObject("ADODB.Command")
    MM_editCmd.ActiveConnection = MM_editConnection
    MM_editCmd.CommandText = MM_editQuery
    MM_editCmd.Execute
    MM_editCmd.ActiveConnection.Close

    If (MM_editRedirectUrl <> "") Then
    Response.Redirect(MM_editRedirectUrl)
    End If
    End If

    End If
    %>
    <%
    Dim Recordset1__MMColParam
    Recordset1__MMColParam = "1"
    If (Request.QueryString("ID") <> "") Then
    Recordset1__MMColParam = Request.QueryString("ID")
    End If
    %>
    <%
    Dim Recordset1
    Dim Recordset1_numRows

    Set Recordset1 = Server.CreateObject("ADODB.Recordset")
    Recordset1.ActiveConnection = MM_CinemaxSite_STRING
    Recordset1.Source = "SELECT * FROM Durango WHERE ID = " +
    Replace(Recordset1__MMColParam, "'", "''") + ""
    Recordset1.CursorType = 0
    Recordset1.CursorLocation = 2
    Recordset1.LockType = 1
    Recordset1.Open()

    Recordset1_numRows = 0
    %>
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">
    <html>
    <head>
    <title>.: Administrador MultiMax :. .: Modificar carterlera :.</title>
    <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
    <style type="text/css">
    <!--
    body {
    background-image: url(images/fondo.jpg);
    }
    .style16 {color: #bdac6d; font-family: Arial, Helvetica, sans-serif;
    font-size: 14px; font-weight: bold; }
    .style8 {font-family: Verdana, Arial, Helvetica, sans-serif;
    font-size: 10px;
    color: #FFFFFF;
    }
    -->
    </style></head>

    <body>

    <div align="center">
    <form ACTION="<%=MM_editAction%>" METHOD="POST"
    enctype="multipart/form-data" name="nuevacartelera" id="nuevacartelera">
    <table width="545" border="0" cellpadding="0" cellspacing="2">
    <tr align="center">
    <td height="50" colspan="7" valign="top"
    background="images/fondo_tit.jpg"><img src="images/trans.gif" width="540"
    height="15"><br>
    <span class="style16">Modificar Cartelera Durango </span></td>
    </tr>
    <tr align="center" valign="top">
    <td colspan="7" bgcolor="#2D4C61"><table width="400" border="0"
    cellpadding="2" cellspacing="2" bgcolor="#2D4C61">
    <tr>
    <td width="141" class="style8"><div align="left">Nombre en
    Espa&ntilde;ol </div></td>
    <td width="245"><div align="left">
    <input name="NombreSpanish" type="text" id="NombreSpanish22"
    value="<%=(Recordset1.Fields.Item("NombreSpanish") .Value)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Nombre en Ingl&eacute;s
    </div></td>
    <td><div align="left">
    <input name="NombreEnglish" type="text" id="NombreEnglish22"
    value="<%=(Recordset1.Fields.Item("NombreEnglish") .Value)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Clasificacion</div></td>
    <td><div align="left">
    <input name="Clasificacion" type="text" id="Clasificacion22"
    value="<%=(Recordset1.Fields.Item("Clasificacion") .Value)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Pais</div></td>
    <td><div align="left">
    <input name="Pais" type="text" id="Pais22"
    value="<%=(Recordset1.Fields.Item("Pais").Value)%> " size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">A&ntilde;o de
    Creaci&oacute;n </div></td>
    <td><div align="left">
    <input name="FechaRelease" type="text" id="FechaRelease22"
    value="<%=(Recordset1.Fields.Item("FechaRelease"). Value)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Director</div></td>
    <td><div align="left">
    <input name="Director" type="text" id="Director22"
    value="<%=(Recordset1.Fields.Item("Director").Valu e)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Reparto</div></td>
    <td><div align="left">
    <input name="Reparto" type="text" id="Reparto22"
    value="<%=(Recordset1.Fields.Item("Reparto").Value )%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Sitio Oficial </div></td>
    <td><div align="left">
    <input name="SitioOficial" type="text" id="SitioOficial22"
    value="<%=(Recordset1.Fields.Item("SitioOficial"). Value)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td class="style8"><div align="left">Horarios</div></td>
    <td><div align="left">
    <input name="Horarios" type="text" id="Horarios22"
    value="<%=(Recordset1.Fields.Item("Horarios").Valu e)%>" size="32">
    </div></td>
    </tr>
    <tr>
    <td valign="top" class="style8"><div
    align="left">Sinopsis</div></td>
    <td><div align="left">
    <textarea name="Sinopsis" cols="32"
    id="textarea2"><%=(Recordset1.Fields.Item("Sinopsi s").Value)%></textarea>
    </div></td>
    </tr>
    <tr>
    <td colspan="2"><div align="center">
    <input type="submit" name="Submit2" value="Modificar
    Cartelera">
    </div></td>
    </tr>
    </table></td>
    </tr>
    </table>


    <input type="hidden" name="MM_recordId" value="<%=
    Recordset1.Fields.Item("NombreSpanish").Value %>">
    <input type="hidden" name="MM_update" value="nuevacartelera">
    <input type="hidden" name="MM_recordId" value="<%=
    Recordset1.Fields.Item("ID").Value %>">
    </form>
    <p>&nbsp;</p>
    </div>
    </body>
    </html>
    <%
    Recordset1.Close()
    Set Recordset1 = Nothing
    %>


    Atmosfera Guest

  6. #5

    Default Re: Updating Records ( Dreamweaver MX 2004, ASP & Access)

    nobody??

    please help


    :(


    Atmosfera Guest

  7. #6

    Default Re: Updating Records ( Dreamweaver MX 2004, ASP & Access)

    nobody?

    :(
    Atmosfera Guest

Posting Permissions

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

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139