Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Inserting into two tables 1

Status
Not open for further replies.

PTmon

IS-IT--Management
Mar 8, 2001
284
0
0
US
I have a from that submits text and one image. I want to submit the text into one table, and the image name and foreign key into a different table. What I have does the first insert, the second insert doesn't happen, but I get no errors.

Code:
<cfquery name="addEditorial" datasource="#application.dsn#">
  Declare @intFK int
  INSERT INTO tblArticles(dtmEntered,dtPublication,strArticleTitle,txtArticle)
VALUES(#CreateODBCDateTime(Now())#,convert(datetime,'#Form.dtPublication#'),'#Form.strArticleTitle#','#Form.txtArticle#')
SET @intFK = Scope_Identity()
INSERT INTO tblImages(intArticleIDFK,strImageName,intSortOrder)
VALUES(@intFK,'#session.strImageName#',1)
</cfquery>
SQL 2000 database, coldfusion 5 server.
Thanks,
pt

putting the "new" in "newb".....
 
instead of

SET @intFK = Scope_Identity()

try

SELECT SCOPE_IDENTITY() AS @intFK


test what you have inside the CFQUERY in Query Analyzer first


r937.com | rudy.ca
 
thanks :)
pt

putting the "new" in "newb".....
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top