Advertisement

10.29.2007 at 11:28AM PDT, ID: 22925102
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

7.4

How can i update many records at once using Access and Cold Fusion

Asked by CoBrentwood in Cold Fusion Markup Language

Tags:

Hello,  I have been fighting this question for a week and thought maybe someone could help me out.  I have a form that inserts into a database and all is good. Now i am working on a page to edit this data.  I need to update 1 record in TABLE A and that works fine. But then in TABLE B i need to update several records at the same time. I am really not sure how to do this.  I will include my code that displays the page for edit and then the code for updating the database.

First off about the database:  Access 2003 with many tables but TABLE A has an auto number and a casenumber besides many other fields.  TABLE B has an auto number can a case_number to relate to TABLE A.

Here is the update code:
editcasenumber.cfm**************************************************************
<cfloop query="getData">
      <cfform name="osform" action="/logger/admin/update.cfm">
      <input name="case_number" type="hidden" value=<cfoutput>"#case_number#"</cfoutput> />
            <tr>
                  <td colspan="3"><span class="style3"><cfoutput>#case_number#</cfoutput></span></td>
            </tr>
            <tr>
                  <td colspan="3">
                        <table width="100%" border="0" cellspacing="0">
                                      <tr>
                                              <td width="10%"><span class="style7">Date:</span></td>
                                    <td width="21%"><span class="style7">
        <input name="date1" type="text" value="<cfoutput>#DateFormat(date1,"MM/DD/YYYY")#</cfoutput>"/>
                                               </span></td>
                                              <td width="9%"><span class="style7">Time:</span></td>
                                              <td width="23%"><span class="style7">
        <input name="time1" type="text" value="<cfoutput>#TimeFormat(time1)#</cfoutput>"/>
                                             </span></td>
                                      </tr>
                                      <tr>
                                              <td><span class="style7">Officer:</span></td>
                                              <td>
<cfif isdefined ("getData.officer")>
<select name="officer">
<cfoutput><OPTION VALUE="#getData.officer#" Selected>#getData.officer#</cfoutput>
<CFOUTPUT QUERY="GetOfficer">
<option value="#officer#" <cfif evaluate("getData.officer") is "#officer#">Selected</cfif>>#officer#</option>
</CFOUTPUT>
</select>
<cfelse>
<select name="officer">
<OPTION VALUE="None" Selected>Select<CFOUTPUT QUERY="GetOfficer">
<option value="#officer#">#officer#</option>
</CFOUTPUT>
</select>
</cfif>&nbsp;                              </td>
                                              <td><span class="style7">Crime:</span></td>
                                              <td><cfif isdefined ("getData.crime")>
<select name="crime">
<cfoutput><OPTION VALUE="#getData.crime#" Selected>#getData.crime#</cfoutput>
<CFOUTPUT QUERY="GetCrime">
<option value="#crime#"<cfif evaluate("getData.crime") is "#crime#">Selected</cfif>>#Crime#</option>
</CFOUTPUT>
</select>
<cfelse>
<select name="crime">
<OPTION VALUE="None" Selected>Select<CFOUTPUT QUERY="GetCrime">
<option value="#crime#">#Crime#</option>
</CFOUTPUT>
</select>
</cfif>&nbsp;                              </td>
                                      </tr>
                                      <tr>
                                              <td><span class="style7">Address:</span></td>
                                              <td colspan="3"><span class="style7">
                                    <input name="address_number" type="text" value="<cfoutput>#address_number#</cfoutput>"/>
                                    &nbsp;&nbsp;&nbsp;
                                    <input name="street_name" type="text" value="<cfoutput>#street_name#</cfoutput>"/>
                                  </span></td>
                                      </tr>
                                      <tr>
                                              <td><span class="style7">@</span></td>
                                              <td><cfif #other_street# neq ""><input name="other_street" type="text" value="<cfoutput>#other_street#</cfoutput>"/></cfif>&nbsp;</td>
                                              <td><span class="style7"><span class="style1">Business:</span></span></td>
                                              <td><cfif #business_location# neq ""><input name="business_location" type="text" value="<cfoutput>#business_location#</cfoutput>"/></cfif>&nbsp;</td>
                                      </tr>
                                      <tr>
                                              <td><span class="style7"><span class="style1">Misc:</span></span></td>
                                              <td colspan="3"><span class="style7"><span class="style1">
                                          <input name="misc" type="test" value="<cfoutput>#misc#</cfoutput>"/></span></span></td>
                                      </tr>
                                      <tr>
                                              <td colspan="4"><span class="style7"><span class="style1">Event Synopsis:</span></span></td>            
                              </tr>
                                           <tr>
                                              <td colspan="4"><span class="style7"><span class="style1">
                                    <input name="event_sys" type="textarea" value="<cfoutput>#event_sys#</cfoutput>"/>
                                  </span></span></td>
                                      </tr>
                                      <tr>
                                              <td height="27" colspan="4"><hr align="left" width="50%" /></td>
                                      </tr>
<cfquery name="getVehicle" datasource="logger">
SELECT *
FROM tblVehicle
WHERE case_number= '#getData.case_number#'
</cfquery>
<cfif getVehicle.recordcount GREATER THAN OR EQUAL TO 1>
                              <tr>
                                              <td colspan="4"><strong>Vehicle Information:&nbsp;</strong></td>
                                          </tr>
<cfoutput query="getVehicle">
<input name="VehicleID" type="hidden" value="#VehicleID#" />
                              <tr>
                                                
                                    <td class="style7">Year:#VehicleID#&nbsp;</td>
                                               <td class="style7"><input name="year" type="text" value="#year#"/></td>
                                    <td class="style7">Make:&nbsp;</td>
                                              <td class="style7"><input name="make" type="text" value="#make#"/>&nbsp;</td>
                              </tr>
                              <tr>
                                              <td class="style7">License:&nbsp;</td>
                                              <td class="style7"><input name="license" type="text" value="#license#"/>&nbsp;</td>
                                              <td class="style7">Status:&nbsp;</td>
                                              <td class="style7"><input name="VehicleStatus" type="text" value="#VehicleStatus#"/>&nbsp;</td>
                                      </tr>
</cfoutput>
</cfif>
                                      <tr>
                                              <td colspan="4"><hr align="left" width="50%" /></td>
                                      </tr>
                                                
                                                
<cfquery name="getSubject" datasource="logger">
      SELECT *
      FROM tblSubject
      WHERE case_number= '#getData.case_number#'
</cfquery>
                                    
<cfif getSubject.recordcount GREATER THAN OR EQUAL TO 1>
                                      <tr>
                                              <td colspan="4"><strong>Subject Information:</strong>&nbsp;</td>
                                      </tr>
                                                
                              <tr>
                                    <td colspan="4">
                                          <table width="100%" border="0" cellspacing="0">
                                    <cfoutput query="getSubject">
                                                <tr>
                                      <td width="10%" class="style7">Last:&nbsp;</td>
                                      <td width="21%" class="style7"><input name="last" type="text" value="#last#"/></td>
                                      <td width="9%" class="style7">First:&nbsp;</td>
                                      <td width="23%" class="style7"><input name="first" type="text" value="#first#"/></td>
                                      <td width="12%" class="style7">Middle&nbsp;</td>
                                      <td width="25%" class="style7"><input name="middle" type="text" value="#middle#"/> &nbsp;</td>
                                    </tr>
                                    <tr>
                                      <td class="style7">DOB:</td>
                                      <td class="style7"><input name="dob" type="text" value="#DateFormat(dob,"MM/DD/YYYY")#"/>&nbsp;</td>
                                      <td class="style7">Gender:</td>
                                      <td class="style7"><input name="gender" type="text" value="#gender#"/>&nbsp;</td>
                                      <td class="style7">Race:&nbsp;</td>
                                      <td class="style7"><input name="race" type="text" value="#race#"/>&nbsp;</td>
                                    </tr>
                                    <tr>
                                      <td class="style7">City:&nbsp;</td>
                                      <td class="style7"><input name="city" type="text" value="#city#"/>&nbsp;</td>
                                      <td class="style7">Status:&nbsp;</td>
                                      <td class="style7"><input name="SubjectStatus" type="text" value="#SubjectStatus#"/>&nbsp;</td>
                                      <td class="style7">Under 18 - &nbsp;</td>
                                      <td class="style7"><input name="confidential" type="checkbox" value="#confidential#" />&nbsp;</td>
                                    </tr>
                                                      </cfoutput>
                                                </cfif>
                                                      <tr>
                                              <td colspan="4"><hr align="left" width="50%" /></td>
                                  </tr>
                                                 
                                              <tr>
                                  <td colspan="6"><input type="submit" name="Submit" value="Update Record" />&nbsp;</td>
                                </tr>
                                      </cfform>
                                    </cfloop>

update.cfm*************************************************************

<cfoutput>#case_number#</cfoutput>

<CFQUERY NAME="DoUpdate" DATASOURCE="logger">
   UPDATE tblCaseReport
   SET crime='#crime#',
   address_number='#address_number#',
   street_name='#street_name#',
   other_street='#other_street#',
   officer='#officer#',
   business_location='#business_location#',
   misc='#misc#',
   event_sys='#event_sys#',
   date1='#date1#',
   time1='#time1#'
 
      WHERE case_number='#case_number#'
</CFQUERY>



<cfquery name="UpdateVehicle" datasource="logger">

UPDATE tblVehicle
SET year='#year#'
WHERE VehicleID = #VehicleID#


</cfquery>


Any help you can give as i really don't know what i am doing here.  
Start Free Trial
 
Loading Advertisement...
 
[+][-]10.30.2007 at 05:09AM PDT, ID: 20176246

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]10.30.2007 at 09:32AM PDT, ID: 20178747

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]11.01.2007 at 05:55PM PDT, ID: 20197712

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]11.02.2007 at 08:28AM PDT, ID: 20201729

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Cold Fusion Markup Language
Tags: Cold Fusion
Sign Up Now!
Solution Provided By: CoBrentwood
Participating Experts: 3
Solution Grade: B
 
 
[+][-]11.02.2007 at 05:46PM PDT, ID: 20205491

Experts Exchange has a courteous staff of administrators who help members get the most out of the website by means of administrative comments like this one.

Start your 7-day free trial to view this Administrative Comment or ask the Experts your question.

 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628