Why not rename your date field to something else instead of "date".
Isn't that a reserved word?

Cody

:::  -----Original Message-----
:::  From: Jake Munson [mailto:[EMAIL PROTECTED]] 
:::  Sent: Wednesday, February 20, 2002 8:39 PM
:::  To: CF-Talk
:::  Subject: RE: Foreign keys
:::  
:::  
:::  Nope, I tried your code with no luck, and I also tried 
:::  just removing the quotes (#form.date#, etc...)
:::  
:::  Any other suggestions?
:::  
:::  -Jake
:::  --- Darryl Lyons <[EMAIL PROTECTED]> wrote:
:::  > Remove the quotes around the date (preferably use VALUES
:::  > (#CreateODBCDate(form.date)#,#techs.id#,etc...)
:::  > 
:::  > Darryl
:::  > 
:::  > -----Original Message-----
:::  > From: Jake Munson [mailto:[EMAIL PROTECTED]]
:::  > Sent: Thursday, 21 February 2002 8:53 AM
:::  > To: CF-Talk
:::  > Subject: RE: Foreign keys
:::  > 
:::  > 
:::  > Thanks for the reply.
:::  > 
:::  > I tried that, and I still got an error with this query: 
:::  "Syntax error 
:::  > in INSERT INTO statement. The error occurred while
:::  > processing an element with a general identifier of
:::  > (CFQUERY)..."
:::  > 
:::  > I know that this table exists in my ODBC source, and that
:::  > the column names match what I have in the query.
:::  > 
:::  > -Jake
:::  > 
:::  > --- Steve Oliver <[EMAIL PROTECTED]> wrote:
:::  > > If the ID's are integers, you don't want to put quotes 
:::  around them.
:::  > > 
:::  > > <CFQUERY NAME="AddLogEntry" DATASOURCE="Software
:::  > > Updates">
:::  > >    INSERT INTO log (date, tech, software, comments)
:::  > >    VALUES ('#form.date#', #techs.id#, #software.id#,
:::  > > '#form.comments#')
:::  > > </CFQUERY>
:::  > > 
:::  > > ______________________
:::  > > steve oliver
:::  > > atnet solutions, inc.
:::  > > http://www.atnetsolutions.com
:::  > > 
:::  > > 
:::  > > -----Original Message-----
:::  > > From: Jake Munson [mailto:[EMAIL PROTECTED]]
:::  > > Sent: Tuesday, February 19, 2002 7:38 PM
:::  > > To: CF-Talk
:::  > > Subject: Foreign keys
:::  > > 
:::  > > 
:::  > > Hi guys,
:::  > > 
:::  > > How can I insert the id field of a query into another 
:::  table?  What I 
:::  > > am wanting is to use the id from one
:::  > table
:::  > > as a foreign key in another table.  To do this, I run 
:::  a query on the 
:::  > > two tables, and then I want to insert the
:::  > primary keys
:::  > > (field named id) from these two tables as foreign keys
:::  > in the second
:::  > > table.
:::  > > 
:::  > > Below is the code I have written that ins't working.
:::  > > 
:::  > > <cfquery datasource="Software Updates" name="techs">
:::  > >        SELECT          * 
:::  > >        FROM            techs
:::  > >        WHERE   tech='#form.tech#'
:::  > >  </cfquery>
:::  > >  <cfquery datasource="Software Updates"
:::  > name="software">
:::  > >        SELECT          * 
:::  > >        FROM            software
:::  > >        WHERE   software='#form.software#'
:::  > >  </cfquery>
:::  > > <CFQUERY NAME="AddLogEntry" DATASOURCE="Software
:::  > > Updates">
:::  > >        INSERT INTO log (date, tech, software, comments)
:::  > >        VALUES ('#form.date#', '#techs.id#', '#software.id#',
:::  > > '#form.comments#')
:::  > > </CFQUERY>
:::  > > 
:::  > > Thanks.
:::  > > 
:::  > > -Jake
:::  > > 
:::  > > __________________________________________________
:::  > > Do You Yahoo!?
:::  > > Yahoo! Sports - Coverage of the 2002 Olympic Games
:::  > > 
:::  > >
:::  > 
:::  > 
:::  >
:::  
:::  ___________________________________________________________
:::  ___________
:::  Dedicated Windows 2000 Server
:::    PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
:::    Instant Activation . $99/Month . Free Setup
:::    http://www.pennyhost.com/redirect.cfm?adcode=coldfusiona
:::  FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
:::  Archives: http://www.mail-archive.com/[email protected]/
:::  Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists
:::  
______________________________________________________________________
Why Share?
  Dedicated Win 2000 Server � PIII 800 / 256 MB RAM / 40 GB HD / 20 GB MO/XFER
  Instant Activation � $99/Month � Free Setup
  http://www.pennyhost.com/redirect.cfm?adcode=coldfusionc
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to