Ask a Question related to Coldfusion Database Access, Design and Development.
-
Aaron Roberson #1
Updating multiple records in a linked table simultaneously
I am working on an e-commerce application and I need help with
updating the product details for a single product with multiple
formats.
--DB STRUCTURE---
Products table:
tbl_Products
fld_prodID (PK, autonum)
fld_prodTitle
fld_prodDesc
Linking Table:
tbl_Prod_details
fld_prodID (FK)
fld_formatID (FK)
Product Formats table:
tbl_ProdFormat
fld_formatID (PK, autonum)
fld_formatTitle
If I wanted to update this product and select multiple formats, would
I have to build two update queries or could I do it with one? What
would the SQL look like?
Thanks for your help and suggestions!
-Aaron
Aaron Roberson Guest
-
Updating Multiple records fields in a database atonce
Is it correct that there is no user interaction on these forms? I didn't see a submit button. Or does someone click on a submit button to get to... -
Updating Multiple Database Rows Simultaneously
Hi, I'm having some trouble with something that should be relatively easy. I want to update multiple rows in one of my database tables... -
updating multiple records on one page
I'm a moderate newcomer to ASP... I have a SQL Server database. I am displaying multiple records on a page. I have a field in the database called... -
updating multiple records via online form
Hello, I have a database generated form that I would like users to be able to update by selecting a checkbox. Say the page displayed has six... -
Updating Multiple Records
I have a table in a database that contains all my photos. The fields are like Name, SRC, GalleryName, DateAdded, SpecialStyle. The only one you may... -
Dan Bracuk #2
Re: Updating multiple records in a linked tablesimultaneously
If the only thing you are doing is giving a product more formats, the answer
might be that you don't run any update queries. You run insert queries into
your tbl_Prod_details table.
If you are changing a format, you do something like
update tbl_Prod_details
set fld_formatID = theNewNumber
where fld_prodID = somenumber
and fld_formatID = theOldNumber
Dan Bracuk Guest
-
Aaron Roberson #3
Re: Updating multiple records in a linked table simultaneously
Dan Bracuk wrote:
In my case, I am updating/inserting multiple formats at once. Therefore,> If the only thing you are doing is giving a product more formats, the answer
> might be that you don't run any update queries. You run insert queries into
> your tbl_Prod_details table.
>
> If you are changing a format, you do something like
>
> update tbl_Prod_details
> set fld_formatID = theNewNumber
> where fld_prodID = somenumber
> and fld_formatID = theOldNumber
>
>
the value for "theOldNumber" in the WHERE clause would be more than 1
number.
Perhaps I could do something like the following:
<cfquery name="qFormats" dsn="#application.dsn#">
SELECT fld_format_ID
FROM tblprodFormats
WHERE fld_format_ID = #newID#
</cfquery>
<cfif qFormats.recordcount > 0>
<cfquery name="updateFormats" dsn="#application.dsn#>
update tbl_Prod_details
set fld_formatID = #fID#
where fld_prodID = #pID#
and fld_formatID = #newID#
</cfquery>
<cfelse>
insertquery
</cfif>
However, this would not solve my problem of inserting or updating more
than one record in the formats table simultaneously.
Any more help would be greatly appreciated at this point!
-Aaron
Aaron Roberson Guest



Reply With Quote

