Advertisement

08.21.2006 at 02:00PM PDT, ID: 21962173
[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!

6.6

Inserting Into multiple tables from one form problem

Asked by dpedersen in ColdFusion Application Server

Tags: , , , ,

hello
i have researched how to do this and my code appears to be correct (at least to me),  but i need to enter data into 2 tables from one form action

my insert code is as follows:

  <cfquery datasource="wcrh_physician_signout">
    INSERT INTO patient (patient_id, first_name, last_name, middle_name, dob, admit_date, med_rec_num, allergies, weight, weight_measurement, sex, race)
    VALUES (
  <cfif IsDefined("FORM.patient_id") AND #FORM.patient_id# NEQ "">
    '#FORM.patient_id#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.first_name") AND #FORM.first_name# NEQ "">
    '#FORM.first_name#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.last_name") AND #FORM.last_name# NEQ "">
    '#FORM.last_name#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.middle_name") AND #FORM.middle_name# NEQ "">
    '#FORM.middle_name#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.dob") AND #FORM.dob# NEQ "">
    '#FORM.dob#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.admit_date") AND #FORM.admit_date# NEQ "">
    '#FORM.admit_date#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.med_rec_num") AND #FORM.med_rec_num# NEQ "">
    '#FORM.med_rec_num#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.allergies") AND #FORM.allergies# NEQ "">
    '#FORM.allergies#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.weight") AND #FORM.weight# NEQ "">
    #FORM.weight#
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.weight_measurement") AND #FORM.weight_measurement# NEQ "">
    '#FORM.weight_measurement#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.sex") AND #FORM.sex# NEQ "">
    '#FORM.sex#'
      <cfelse>
    NULL
  </cfif>
    ,
  <cfif IsDefined("FORM.race") AND #FORM.race# NEQ "">
    '#FORM.race#'
      <cfelse>
    NULL
  </cfif>
    )
  </cfquery>

  <cfquery datasource="wcrh_physician_signout">
    INSERT INTO general (patient_id, subjective, o-t, o-hr)
    VALUES (
    '#FORM.patient_id#',
    '#FORM.subjective#',
    '#FORM.ot#',
    '#FORM.ohr#'
    )
  </cfquery>


the coldfusion error i am getting is this:

Error Executing Database Query.  
[Macromedia][SequeLink JDBC Driver][ODBC Socket][Microsoft][ODBC Microsoft Access Driver] Syntax error in INSERT INTO statement.  
 
The error occurred in C:\Inetpub\darrenpedersen.com\signout\insert_patient_action.cfm: line 85
 
83 :     '#FORM.subjective#',
84 :     '#FORM.ot#',
85 :     '#FORM.ohr#'
86 :     )
87 :   </cfquery>

 

--------------------------------------------------------------------------------
 
SQL    INSERT INTO general (patient_id, subjective, o-t, o-hr) VALUES ( '5', 'NOT EXAMINED', 'NOT EXAMINED', '45ds' )  
DATASOURCE   wcrh_physician_signout
VENDORERRORCODE   -3502
SQLSTATE   42000
 
even if i remove form.ohr then it just throws the error on o-t.  i have tried wrapping them in cftransaction tags but still same issues...

Start Free Trial
 
Keywords: Inserting Into multiple tables from one f…
 
Loading Advertisement...
 
[+][-]08.21.2006 at 02:29PM PDT, ID: 17359513

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: ColdFusion Application Server
Tags: tables, form, access, one, insert
Sign Up Now!
Solution Provided By: crosenblum
Participating Experts: 1
Solution Grade: C
 
 
[+][-]08.21.2006 at 02:35PM PDT, ID: 17359557

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.

 
[+][-]08.21.2006 at 04:58PM PDT, ID: 17360274

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.

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