Ask a Question related to Coldfusion Database Access, Design and Development.

  1. #1

    Default UPDATE

    I'm trying to update my database fields
    Employee, Status and Location with values from a form.
    Is this going to work?

    Dim strEmployee, strStatus, strLocation

    strEmployee= request.form("Employee")
    strStatus = Request.Form("Status")
    strLocation = Request.Form("Location")

    SQLstmt = "UPDATE Table SET "

    SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
    SQLstmt = SQLstmt & "RS("Status")= strStatus"
    SQLstmt = SQLstmt & "RS("Location")= strLocation"
    alexz Guest

  2. Similar Questions and Discussions

    1. why is the "Adobe Acrobat 6.0.1 Update" message there at the top? -- the update doesn't work
      why is the "Adobe Acrobat 6.0.1 Update" message there there at the top? -- the update doesn't work
    2. can't update to 6.01 pro
      updater does not work tells me I need msi file I HAVE msi file on my AcroPro CD, and I am correctly navigating to it. Installer tells me msi is...
    3. PSE Update?
      From www.sitelink.net: CNET News.com reports that Adobe is preparing to make several major product announcements -- including a new version of...
    4. 5.0.7 Update Pack 1 requires SCO Update license?
      I was just up on SCO's FTP site and noticed they have, as of today, Update Pack 1 and Maintenance Pack 1. I have a question about the Update Pack...
    5. Specifying "do not update" values in "additive" UPDATE sprocs
      Hello, I want to write a sproc whose purpose is to perform 'additive' UPDATEs to a given table. By 'additive', I mean I would like the existing...
  3. #2

    Default Re: UPDATE

    No, try this:

    strEmployee= request.form("Employee")
    strStatus = Request.Form("Status")
    strLocation = Request.Form("Location")

    SQLstmt = "UPDATE Table SET [Employee]='" & strEmployee & "',[Status]='" &
    strStatus & "',[Location]='" & strLocation & "'"

    That statement will update EVERY record though if you don't have a WHERE
    clause, i.e. WHERE [EmployeedID]=6.

    Ray at work


    "alexz" <alexz33@hotmail.com> wrote in message
    news:43d72b53.0307170855.1221c25f@posting.google.c om...
    > I'm trying to update my database fields
    > Employee, Status and Location with values from a form.
    > Is this going to work?
    >
    > Dim strEmployee, strStatus, strLocation
    >
    > strEmployee= request.form("Employee")
    > strStatus = Request.Form("Status")
    > strLocation = Request.Form("Location")
    >
    > SQLstmt = "UPDATE Table SET "
    >
    > SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
    > SQLstmt = SQLstmt & "RS("Status")= strStatus"
    > SQLstmt = SQLstmt & "RS("Location")= strLocation"

    Ray at Guest

  4. #3

    Default Re: UPDATE

    On 17 Jul 2003 09:55:27 -0700, [email]alexz33@hotmail.com[/email] (alexz) wrote:
    >I'm trying to update my database fields
    >Employee, Status and Location with values from a form.
    >Is this going to work?
    >
    >Dim strEmployee, strStatus, strLocation
    >
    >strEmployee= request.form("Employee")
    >strStatus = Request.Form("Status")
    >strLocation = Request.Form("Location")
    >
    >SQLstmt = "UPDATE Table SET "
    >
    >SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
    >SQLstmt = SQLstmt & "RS("Status")= strStatus"
    >SQLstmt = SQLstmt & "RS("Location")= strLocation"
    It appears that you are not telling the database table which records to update ---So it may update all your existing
    records
    You may want to add something like

    SQLstmt = SQLstmt & " Where some_field_in_the_table = some_field_to_identify_which_record_get_this_updat e"

    ( I am not sure what the RS refers to, since I do not see any Recordset )




    TurkBear Guest

  5. #4

    Default Re: UPDATE

    TurkBear <noone@nowhere.com> wrote in message news:<skmdhvg2hosm1oso21jr0265sdb4u35ft5@4ax.com>. ..
    > On 17 Jul 2003 09:55:27 -0700, [email]alexz33@hotmail.com[/email] (alexz) wrote:
    >
    > >I'm trying to update my database fields
    > >Employee, Status and Location with values from a form.
    > >Is this going to work?
    > >
    > >Dim strEmployee, strStatus, strLocation
    > >
    > >strEmployee= request.form("Employee")
    > >strStatus = Request.Form("Status")
    > >strLocation = Request.Form("Location")
    > >
    > >SQLstmt = "UPDATE Table SET "
    > >
    > >SQLstmt = SQLstmt & "RS("Employee")= strEmployee"
    > >SQLstmt = SQLstmt & "RS("Status")= strStatus"
    > >SQLstmt = SQLstmt & "RS("Location")= strLocation"
    >
    > It appears that you are not telling the database table which records to update ---So it may update all your existing
    > records
    > You may want to add something like
    >
    > SQLstmt = SQLstmt & " Where some_field_in_the_table = some_field_to_identify_which_record_get_this_updat e"
    >
    > ( I am not sure what the RS refers to, since I do not see any Recordset )
    Thanks, Got it working.
    alexz Guest

  6. #5

    Default Re: Update

    If this is for SW, there's no intermovie communication, nor do global
    variables allow you to hold a value. Use setPref and getPref to hold a
    value and then have the other movie retreive it. Look at the example in
    the Lingo Dictionary.

    --
    Rob
    _______
    Rob Dillon
    Team Macromedia
    [url]http://www.ddg-designs.com[/url]
    412-243-9119

    [url]http://www.macromedia.com/software/trial/[/url]
    Rob Dillon Guest

  7. #6

    Default Re: Update

    But iīm using this segments, but this broke!!!!!

    I think be memory cache or buffer....

    how do I Clean ??


    "Rob Dillon" <rob@ddg-designs.com> escreveu na mensagem
    news:080920031547530387%rob@ddg-designs.com...
    > If this is for SW, there's no intermovie communication, nor do global
    > variables allow you to hold a value. Use setPref and getPref to hold a
    > value and then have the other movie retreive it. Look at the example in
    > the Lingo Dictionary.
    >
    > --
    > Rob
    > _______
    > Rob Dillon
    > Team Macromedia
    > [url]http://www.ddg-designs.com[/url]
    > 412-243-9119
    >
    > [url]http://www.macromedia.com/software/trial/[/url]

    Jota Mix Guest

  8. #7

    Default Re: Update

    SetPref and getPref don't use the cache, the file is actually written
    the user's hard drive in a folder in the same location as the plugin.

    It should always work, even if you don't have write permission.

    In what way do you think that this is broken?

    --
    Rob
    _______
    Rob Dillon
    Team Macromedia
    [url]http://www.ddg-designs.com[/url]
    412-243-9119

    [url]http://www.macromedia.com/software/trial/[/url]
    Rob Dillon Guest

  9. #8

    Default Re: Update

    I donīt know what is hapened!!!

    Iīm making a program that save a record in 3 members, and this members (
    external cast ) will be opened another movie, bur it isnīt updating... the
    records be old records.... sorry my english, Iīm brasilian, i donīt know if
    you understand me.... do you understand????


    tks...
    "Rob Dillon" <rob@ddg-designs.com> escreveu na mensagem
    news:090920030805304939%rob@ddg-designs.com...
    > SetPref and getPref don't use the cache, the file is actually written
    > the user's hard drive in a folder in the same location as the plugin.
    >
    > It should always work, even if you don't have write permission.
    >
    > In what way do you think that this is broken?
    >
    > --
    > Rob
    > _______
    > Rob Dillon
    > Team Macromedia
    > [url]http://www.ddg-designs.com[/url]
    > 412-243-9119
    >
    > [url]http://www.macromedia.com/software/trial/[/url]

    Jota Mix Guest

  10. #9

    Default Re: Update

    If this is a Shockwave movie, then you can't use save castLib to update
    members. The cast that you would be updating would be the local one in
    your cache, and that would only benefit you. Save castLib can't reach
    back out to the server and save a new version, that's disabled.

    Depending on the content for these members, you may be able to use one
    of the SW exporting Xtras to save your new members out to a server. If
    it's just text that you want to save, then you can use setPref and
    getPref to hold that content. Again, that's a local thing and so it
    will only effect your movie, not the content on the server.

    --
    Rob
    _______
    Rob Dillon
    Team Macromedia
    [url]http://www.ddg-designs.com[/url]
    412-243-9119

    [url]http://www.macromedia.com/software/trial/[/url]
    Rob Dillon Guest

  11. #10

    Default Re: Update

    Ok, iīm using setpref and getpref, but the datas donīt change!!!!

    it isnīt a shockwave....


    "Rob Dillon" <rob@ddg-designs.com> escreveu na mensagem
    news:090920030912386769%rob@ddg-designs.com...
    > If this is a Shockwave movie, then you can't use save castLib to update
    > members. The cast that you would be updating would be the local one in
    > your cache, and that would only benefit you. Save castLib can't reach
    > back out to the server and save a new version, that's disabled.
    >
    > Depending on the content for these members, you may be able to use one
    > of the SW exporting Xtras to save your new members out to a server. If
    > it's just text that you want to save, then you can use setPref and
    > getPref to hold that content. Again, that's a local thing and so it
    > will only effect your movie, not the content on the server.
    >
    > --
    > Rob
    > _______
    > Rob Dillon
    > Team Macromedia
    > [url]http://www.ddg-designs.com[/url]
    > 412-243-9119
    >
    > [url]http://www.macromedia.com/software/trial/[/url]

    Jota Mix Guest

  12. #11

    Default Re: Update

    OK, now I'm completely confused.

    If you want to hold data from one Director movie to the next in the
    same session, then you can use a global variable. If you're not working
    with Shockwave then don't use setPref and getPref. While it works well
    with Shockwave, there are restrictions on using it with a projector.

    Look in the Lingo Dictionary and the Learning Example movies for more
    on these commands.

    Back to the problem at hand. If you are changing the content of a
    member in movie A, are you using that member in movie B in the same
    Director session? In other words are you going directly from movie A to
    movie B, or are you quiting the projector and then starting it again
    before you go to movie B?

    If you open movie A, change a member in the external shared cast, and
    then go to movie B, the change should show up in that member in movie
    B.

    If you open movie A, change a member in the external shared cast, and
    then quit the movie. Open movie B, the changed member will not show the
    change, because it wasn't saved before you quit the first movie.

    If you are quiting the first movie, then you need to use save castLib
    to save that change. If you are running from a CD then you will have to
    save the castLib to the user's hard drive. Then you will need to search
    for that cast when you start up again and link the version saved to the
    user's drive to your movie.

    --
    Rob
    _______
    Rob Dillon
    Team Macromedia
    [url]http://www.ddg-designs.com[/url]
    412-243-9119

    [url]http://www.macromedia.com/software/trial/[/url]
    Rob Dillon Guest

  13. #12

    Default Re: Update

    tks Rob...

    my problem was that when I come the movie B, it doesnīt make a update in the
    movie, it opened the movie B on final frame, so doesnīt make the lingo
    programation!!!

    so, if for there and another ifīs... itīs ok now!!!!


    thanks for help!!!!

    if you want, I send the final project for you see... if you want, give me
    your personal email!!!!

    tks!!!!



    "Rob Dillon" <rob@ddg-designs.com> escreveu na mensagem
    news:090920031008213980%rob@ddg-designs.com...
    > OK, now I'm completely confused.
    >
    > If you want to hold data from one Director movie to the next in the
    > same session, then you can use a global variable. If you're not working
    > with Shockwave then don't use setPref and getPref. While it works well
    > with Shockwave, there are restrictions on using it with a projector.
    >
    > Look in the Lingo Dictionary and the Learning Example movies for more
    > on these commands.
    >
    > Back to the problem at hand. If you are changing the content of a
    > member in movie A, are you using that member in movie B in the same
    > Director session? In other words are you going directly from movie A to
    > movie B, or are you quiting the projector and then starting it again
    > before you go to movie B?
    >
    > If you open movie A, change a member in the external shared cast, and
    > then go to movie B, the change should show up in that member in movie
    > B.
    >
    > If you open movie A, change a member in the external shared cast, and
    > then quit the movie. Open movie B, the changed member will not show the
    > change, because it wasn't saved before you quit the first movie.
    >
    > If you are quiting the first movie, then you need to use save castLib
    > to save that change. If you are running from a CD then you will have to
    > save the castLib to the user's hard drive. Then you will need to search
    > for that cast when you start up again and link the version saved to the
    > user's drive to your movie.
    >
    > --
    > Rob
    > _______
    > Rob Dillon
    > Team Macromedia
    > [url]http://www.ddg-designs.com[/url]
    > 412-243-9119
    >
    > [url]http://www.macromedia.com/software/trial/[/url]

    Jota Mix Guest

  14. #13

    Default Update

    :confused; I am retrieving data from the database and altering some information
    but I get an error which does not make sense because the line indicati ng the
    error is properly compiled. Please help

    My code is attached:

    form code
    <!--- Check that FilmID was provided --->
    <cfif NOT IsDefined("URL.FilmID")>
    <h1>You did not specify the FilmID</h1>
    <cfabort>
    </cfif>

    <!--- Get the film record --->
    <cfquery datasource="ows" name="film">
    SELECT FilmID, MovieTitle, PitchText,
    AmountBudgeted, RatingID,
    Summary, ImageName, DateInTheaters
    FROM Films
    WHERE FilmID=#URL.FilmID#
    </cfquery>

    <!--- Get Ratings --->
    <cfquery datasource="ows" name="ratings">
    SELECT RatingID, Rating
    FROM FilmsRatings
    ORDER BY RatingID
    </cfquery>

    <!--- Page header --->
    <cfinclude template="../9/ows_header.cfm">

    <!--- Update movie form --->
    <CFFORM ACTION="update2.cfm">

    <!--- Embed primary key as a hidden field --->
    <cfoutput>
    <input type="hidden" name="FilmID" value="#Film.FilmID#">
    </cfoutput>

    <TABLE ALIGN="center" BGCOLOR="orange">
    <TR>
    <TH COLSPAN="2">
    <FONT SIZE="+1">Update a Movie</FONT>
    </TH>
    </TR>
    <TR>
    <TD>
    Movie:
    </TD>
    <TD>
    <CFINPUT TYPE="Text"
    NAME="MovieTitle"
    VALUE="#Trim(film.MovieTitle)#"
    MESSAGE="MOVIE TITLE is required!"
    REQUIRED="Yes"
    SIZE="50"
    MAXLENGTH="100">
    </TD>
    </TR>
    <TR>
    <TD>
    Tag line:
    </TD>
    <TD>
    <CFINPUT TYPE="Text"
    NAME="PitchText"
    VALUE="#Trim(film.PitchText)#"
    MESSAGE="TAG LINE is required"
    REQUIRED="Yes"
    SIZE="50"
    MAXLENGTH="100">
    </TD>
    </TR>
    <TR>
    <TD>
    Rating:
    </TD>
    <TD>
    <!--- Ratings list --->
    <SELECT NAME="RatingID">
    <CFOUTPUT QUERY="ratings">
    <OPTION VALUE="#RatingID#">#Rating# <cfif ratings.RatingID
    IS
    film.RatingID>SELECTED</cfif>#Rating#</OPTION>
    </CFOUTPUT>
    </SELECT>
    </TD>
    </TR>
    <TR>
    <TD>
    Summary:
    </TD>
    <TD>
    <cfoutput>
    <TEXTAREA NAME="summary"
    COLS="40"
    ROWS="5"
    WRAP="virtual">#Trim(Film.Summary)#</TEXTAREA>
    </cfoutput>
    </TD>
    </TR>
    <TR>
    <TD>
    Budget:
    </TD>
    <TD>
    <CFINPUT TYPE="Text"
    NAME="AmountBudgeted"
    VALUE="#Int(film.AmountBudgeted)#"
    MESSAGE="BUDGET must be a valid numeric Amount!"
    VALIDATE="integer"
    REQUIRED="NO"
    SIZE="10"
    MAXLENGTH="10">
    </TD>
    </TR>
    <TR>
    <TD>
    Release Date:
    </TD>
    <TD>
    <CFINPUT TYPE="Text"
    NAME="DateInTheaters"
    VALUE="#DateFormat(film.DateInTheaters, "MM/DD/YYYY")#"
    MESSAGE="RELEASE DATE must be a valid date!"
    VALIDATE="date"
    REQUIRED="NO"
    SIZE="10"
    MAXLENGTH="10">
    </TD>
    </TR>
    <TR>
    <TD>
    Image File:
    </TD>
    <TD>
    <CFINPUT TYPE="Text"
    NAME="ImageName"
    VALUE="#Trim(film.ImageName)#"
    REQUIRED="NO"
    SIZE="20"
    MAXLENGTH="50">
    </TD>
    </TR>
    <TR>
    <TD COLSPAN="2" ALIGN="center">
    <INPUT TYPE="submit" VALUE="Update">
    </TD>
    </TR>
    </TABLE>

    </CFFORM>

    <!--- Page footer --->
    <CFINCLUDE TEMPLATE="../9/ows_footer.cfm">

    &&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&& &&&&&&&&&&&&&&&&&&&&&&&&&&&&


    Processing page

    <!--- Update movie --->
    <cfquery datasource="ows">
    Update Films
    SET MovieTitle='#Trim(FORM.MovieTitle)#',
    PitchText='#Trim(FORM.PitchText)#',
    AmountBudgeted='#Trim(FORM.AmountBudgeted)#',
    RatingID=#Trim(FORM.RatingID)#,
    Summary='#Trim(FORM.Summary)#',
    ImageName='#Trim(FORM.ImageName)#',
    DateInTheaters=#CreateODBCDate(FORM.DateInTheaters )#
    WHERE FilmID=#FORM.FilmID#
    </cfquery>

    <!--- Page header --->
    <cfinclude template="../9/ows_header.cfm">

    <!--- Feedback --->
    <cfoutput>
    <h1>New movie #FORM.MovieTitle# updated</h1>
    </cfoutput>

    <!--- Page footer --->
    <cfinclude template="../9/ows_footer.cfm">

    @@@@@@@@@@@@@@@ ERROR MESSAGE @@@@@@@@@@@@@@@@@@@@@@@@@@@@@

    Error Executing Database Query.
    [Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft
    Access Driver] Operation must use an updateable query.

    The error occurred in D:\StudioMX2004\ColdFusion\wwwroot\ows\13\update2. cfm:
    line 18

    16 : ImageName='#Trim(FORM.ImageName)#',
    17 : DateInTheaters=#CreateODBCDate(FORM.DateInTheaters )#
    18 : WHERE FilmID=#FORM.FilmID#
    19 : </cfquery>
    20 :




    --------------------------------------------------------------------------------

    SQL Update Films SET MovieTitle='Closet Encounters of the Odd Kind',
    PitchText='Some things should remain in the closet', AmountBudgeted='350001',
    RatingID=1, Summary='One man find out more than he ever wanted to know about
    the skeletons in his closet - and not just figuratively either.',
    ImageName='f3.gif', DateInTheaters={d '2000-11-07'} WHERE FilmID=3
    DATASOURCE ows
    VENDORERRORCODE -3035
    SQLSTATE HY000

    Abdlah Guest

  15. #14

    Default Re: Update

    <cfquery datasource="ows">

    Not sure if this is causing the error, but according to MM docs, all querys must have the required "name" attribute. Try naming your query and see if that works.
    Tulsa Guest

  16. #15

    Default Re: Update

    yeah i think that's the case with access update queries. You don't need a name for MS SQL queries when updating.
    byron1021 Guest

  17. #16

    Default UPDATE

    <HTML>
    <HEAD>
    <META NAME="GENERATOR" Content="Microsoft DHTML Editing Control">
    <TITLE></TITLE>
    </HEAD>
    <BODY>
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B
    style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt">SFNN- - - POWERFUL HIDDEN BOTTOM
    PLAY!!!<o:p></O:P></SPAN></B></P>
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B><SPAN
    style="FONT-SIZE: 14pt; COLOR: black">CURRENT PRICE=
    ..003<o:p></O:P></SPAN></B></P>
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B><SPAN
    style="FONT-SIZE: 14pt; COLOR: black">TARGET PRICE = 15 CENTS<SPAN
    style="mso-spacerun: yes">&nbsp; </SPAN><o:p></O:P></SPAN></B></P>
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B><SPAN
    style="FONT-SIZE: 14pt; COLOR: black">TARGET HOLD TIME = 9
    MONTHS<o:p></O:P></SPAN></B></P>
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B
    style="mso-bidi-font-weight: normal"><SPAN style="FONT-SIZE: 14pt">ESTIMATED
    ROI= 4500%<o:p></O:P></SPAN></B></P>
    <P class=MsoNormal style="MARGIN: 0in 0in 0pt"><B
    style="mso-bidi-font-weight: no
    LRS 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