Forum Moderators: open

Message Too Old, No Replies

Popup Form for table with 2 Primary Keys, help!

         

stud3

7:56 pm on Mar 1, 2005 (gmt 0)

10+ Year Member



hi,
I have a Problem, I have a page, it shows a table from a database, every row in the table has a button "Delete" and a button "Update", now when I click Delete or Update, the page shows me a Popup Form to the selected row in the table, the form has (for example for Updating)felds filled with values to the selected row (Reference: Primary Key):

window.open('change.asp?Product_id=' + Product_id + '&form_action=chg','', 'width=400 height=400')

does anybody know, how can I make this if the table has two Primary Keys? I'll appreciate your help.

Easy_Coder

10:13 pm on Mar 1, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



2 Primary Keys? You mean multiple columns make up your Primary Key?

What are the columns in your PK?

stud3

11:22 pm on Mar 1, 2005 (gmt 0)

10+ Year Member



hi EasyCoder,
the Primary Keys are RC_Number and Client_ID...

Easy_Coder

1:48 pm on Mar 2, 2005 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Ah, so you just would like to delete a single row right?

You're going to need to bake your primary key into the form or click event so that it's passed into your pop window.

window.open('change.asp?Product_id=' + Product_id + '&client=' + Client_ID + '&form_action=chg','', 'width=400 height=400')

Then your query will need to cover the entire key wether your updating or deleting:

update products set something='test' where RC_Number='prodidvaluehere' and Client_ID='clientidvaluehere'

or

delete products where RC_Number='prodidvaluehere' and Client_ID='clientidvaluehere'

stud3

6:12 pm on Mar 2, 2005 (gmt 0)

10+ Year Member



thanks for answering, it will help me, regards.