Update one datasource using a 2nd datasource?

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

  1. #1

    Default Update one datasource using a 2nd datasource?

    I have a CF app using an Access 2000 DB, Treasury. One of the tables holds
    user data (i.e. location, city, state, supervisor, etc.). This data is updated
    sporadically. I have been given a view for an Oracle DB, WebPhone, which has
    this information that is updated daily. I would like to update the Treasury
    table with the information from the WebPhone DB. I can query both DB?s:

    <cfquery name="GetUserInfo" datasource="treasury">
    SELECT sbcuid, last, first, add1, add2, city,
    state, zip, phone, fax, email, sprvsr_id
    FROM sbcuid2
    WHERE status <> 'No'
    </cfquery>

    <cfquery name="GetWebPhone" datasource="WebPhone">
    select sbcuid, last_name, UNOFFICIAL_FIRST_NAME, WORK_STREET_ADDR_1,
    WORK_STREET_ADDR_2,
    WORK_city, WORK_state, WORK_zip, WORK_phone, WORK_fax, EMAIL_ALIAS,
    SUPERVISOR_ID
    from web_phone_view
    WHERE LOWER('#getuserinfo.sbcuid#') = sbcuid
    </cfquery>

    I have tried a qoq, but was returned an ?update not supported? message. This
    is what I want to do:

    update sbcuid2
    set
    #getuserinfo.last# = #GetWebPhone.last_name#
    #getuserinfo.first# = #GetWebPhone.UNOFFICIAL_FIRST_NAME#
    #getuserinfo.add1# = #GetWebPhone.WORK_STREET_ADDR_1#
    #getuserinfo.add2# = #GetWebPhone.WORK_STREET_ADDR_2#
    #getuserinfo.city# = #GetWebPhone.WORK_city#
    #getuserinfo.state# = #GetWebPhone.WORK_state#
    #getuserinfo.zip# = #GetWebPhone.WORK_zip#
    #getuserinfo.phone# = #GetWebPhone.WORK_phone#
    #getuserinfo.fax# = #GetWebPhone.WORK_fax#
    #getuserinfo.EMAIl# = #GetWebPhone.EMAIL_ALIAS#
    #getuserinfo.sprvsr_id# = #GetWebPhone.SUPERVISOR_ID#
    WHERE LOWER('#getuserinfo.sbcuid#') = '#GetWebPhone.sbcuid#'

    Any ideas? Any help is greatly appreciated! :D

    Libby Guest

  2. Similar Questions and Discussions

    1. Join a query datasource and oledb datasource?
      Using CF5 here. I have a query that I'm creating on the fly using the QueryNew() and QueryAddRow() functions. Then I run my query using...
    2. HELP!- Datasource
      How do I specify a new datasource?
    3. Datasource
      Maybe I will have better luck with the SQL datasource. There may be some quirks in the OLE one. Who knows. Don't you also have to supply your...
    4. DataGrid ItemStyle is a textbox and doesn't update the datagrid datasource
      I have a datagrid with two columns, the first a normal bound column, the second is a template column created from a bound column. For the...
    5. XML as a datasource
      Aside from reading XM:L into a dataset and populating a datagrid is there any way to have a grid bind right to XML. I have seen the data girds in...
  3. #2

    Default Re: Update one datasource using a 2nd datasource?

    One possible way (that would be independent of CF) would be to use ODBC to link
    your Oracle table/view within Access. Then, you could actually treat the linked
    Oracle table as an Access table within your Access DSN so that you could join
    the tables in the same query.

    Otherwise, you could select from your Access database, then use CFLOOP or
    CFOUTPUT to loop through each selected row to select from your Oracle database,
    then Update the particular Access row. Not very efficient, but it should work.

    Phil



    <cfquery name="GetUserInfo" datasource="treasury">
    SELECT sbcuid, last, first, add1, add2, city,
    state, zip, phone, fax, email, sprvsr_id
    FROM sbcuid2
    WHERE status <> 'No'
    </cfquery>

    <cfoutput query="GetUserInfo">

    <cfquery name="GetWebPhone" datasource="WebPhone">
    select sbcuid, last_name, UNOFFICIAL_FIRST_NAME, WORK_STREET_ADDR_1,
    WORK_STREET_ADDR_2,
    WORK_city, WORK_state, WORK_zip, WORK_phone, WORK_fax, EMAIL_ALIAS,
    SUPERVISOR_ID
    from web_phone_view
    WHERE LOWER('#getuserinfo.sbcuid#') = sbcuid
    </cfquery>

    <cfquery name="UpdUserInfo" datasource="treasury">
    update sbcuid2
    set
    last = #GetWebPhone.last_name#
    first = #GetWebPhone.UNOFFICIAL_FIRST_NAME#
    add1 = #GetWebPhone.WORK_STREET_ADDR_1#
    add2 = #GetWebPhone.WORK_STREET_ADDR_2#
    city = #GetWebPhone.WORK_city#
    state = #GetWebPhone.WORK_state#
    zip = #GetWebPhone.WORK_zip#
    phone = #GetWebPhone.WORK_phone#
    fax = #GetWebPhone.WORK_fax#
    EMAIl = #GetWebPhone.EMAIL_ALIAS#
    sprvsr_id = #GetWebPhone.SUPERVISOR_ID#
    WHERE LOWER(sbcuid) = '#GetWebPhone.sbcuid#'

    </cfoutput>

    paross1 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