updating a database.

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

  1. #1

    Default updating a database.

    at the moment is am trying to create a page to update a database.

    i select the a company in a list which the gets forwarded to the next page. On
    the next page i tell the page that the it has to display all the information
    from the selected company by telling it that "Where #form.companytxt# =
    CompanyCode"


    the problem i am getting is that it puts all the information into a form.
    however when i want to update the form it refers to "companytxt" from the above
    statement. And as it is not in this form it is getting confused. what would be
    the best way of doing this?

    Samurai_Sjakkie Guest

  2. Similar Questions and Discussions

    1. updating database
      I posted this in the general dis part too but maybe this is better place since it has to do with forms... here is my problem I need to overcome....
    2. MS Access Database not Updating
      Hi, I am working on creating dynamic home pages with Coldfusion MX on the server, Dreamweaver for developing and Microsoft Access as the backend...
    3. Updating a Database
      Hi I am just learning asp.net and have hit a wall with the datagrid control. I have populated a datagrid and am able to edit fields and retrieve...
    4. SQL not Updating Access Database
      Hi, I have an ASP page that updates an Access 2000 database. It doesnt seem to update the date field of the table. Here is the SQL: Update...
    5. Updating Database with ASP
      Hi, I'm just learning how to use ASP and I've been trying to figure out how to add records to my database. I'm learning it out of a book and...
  3. #2

    Default Re: updating a database.

    i was thinking could i have something where it refers to form1(first page) to get the company name and form2 (second page) to update the sql database?

    Samurai_Sjakkie Guest

  4. #3

    Default Re: updating a database.

    It seems as though your WHERE clause is backwards. It probably should be WHERE companyCode = '#form.companyTxt#'
    jdeline Guest

  5. #4

    Default Re: updating a database.

    even changing that it cant find find it after i click update.

    would it be handier to do an

    <cfif not isdefined (#form.companytxt#)>
    cflocation ****firstpage*****
    <cfidelse>
    cflocation *****this page ?sid=#form.companytxt#
    </cfif>

    and then set the where statement to companyCode = '#URL.SIDt#'

    I think the problem is with the dropdown menu select in the previous
    page.........

    Samurai_Sjakkie Guest

  6. #5

    Default Re: updating a database.

    If you managed to pass a company code from a select from page 1 to page 2, the
    problem is not with page 1. Question, what are you doing with the company
    code on page 2? If you are not converting it to a session variable or a hidden
    form field on your page 2 form, how are you going to know what record to update
    on page 3?

    Dan Bracuk Guest

  7. #6

    Default Re: updating a database.

    i am totally new to this.but i thought i had created a hidden field...

    <input type="hidden" name="companytxt" value="#form.companytxt#">

    but this didn't work.....

    Stupdi question but how do i convert it to a session variable?

    Samurai_Sjakkie Guest

  8. #7

    Default Re: updating a database.

    To convert it to a session variable,
    <cfset session.companytxt = form.companytxt>

    Before you do that, put this at the top of page 3.
    <cfdump var="#form#">
    <cfabort>

    Does your hidden field show up?

    Dan Bracuk Guest

  9. #8

    Default Re: updating a database.

    Coldfusion is harder than i thought. i have got the following done so far...
    but then i get the error

    Parameter 1 of function IsDefined, which is now
    '2B617C71-B310-4D13-B9At3AFBE454FDE1', must be a syntactically valid variable
    name. how do i remove the &quote; ?






    <!---Set A list of values --->
    <cfquery name="retrieve" datasource="test1">
    SELECT *
    From company
    where CompanyCode = "#form.companytxt#";
    </cfquery>

    <CFIF NOT IsDefined (#form.companytxt#)>
    <CFLOCATION URL="main.cfm">
    </cfif>


    <!--- Create the list that needs to bee edited. --->




    <!--- To Modify the list --->


    <cfoutput><form action="companyupdate.cfm" method="post">
    <table width="90%" border="1">
    <tr>
    <td><table border="0">
    <tr>
    <td>Supplier Name</td>
    <td><input type="hidden" name="companytxt"
    value="#retrieve.CompanyCode#"</td>
    <td><input name="CompanyName" value="#retrieve.CompanyName#"
    size="40"></td>
    </tr>
    <tr>
    <td>Adress 1</td>
    <td></td>
    <td><input name="Address1" value="#retrieve.Address#"
    size="40"></td>
    </tr>
    <tr>
    <td>City</td>
    <td></td>
    <td><input name="City" value="#retrieve.City#" size="40"></td>
    </tr>
    <tr>
    <td>PostCode</td>
    <td></td>
    <td><input name="Postcode" value="#retrieve.PostCode#"
    size="40"></td>
    </tr>
    </table></td>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr>
    <td></td>
    <td></td>
    <td></td>
    </tr>
    <tr></tr>
    <tr>
    <td>
    <tr>
    <td ><input name="" type="checkbox" value="ModCheck"></td>
    <td>Are you sure you would like to update The Details.</td>
    </tr>
    <tr><td>&nbsp;</td></tr>
    <tr>
    <td></td>
    <td><div align="center">
    <input type="Submit" name="updateDB" value="Update">
    </div></td>
    </tr>
    </table></td>

    </tr>
    </table>
    </form>
    </cfoutput>

    Samurai_Sjakkie 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