I must request about the style of table according to it's editability inside a Power grid View. Allow me to explain. For instance, I've got a table named ProductCustomerRel.

Method 1

CustomerCode varchar  PK
ProductCode varchar  PK
StoreCode varchar PK
Quantity int
Note text

Therefore the mixture of the CustomerCode, StoreCode and ProductCode should be unique. The record is shown on a gridview. The necessity is you can edit the client, product and storecode however when the information is saved, the PK constraint must still persist.

The issue here's it might be natural for any power grid to have the ability to edit the three primary key, you are able to only attain the update operation from the power grid view beginning with removing the row after which placing the row using the up-to-date data.

An alternative choice to this really is to simply update the table and give a SeqNo, and merely enforce the initial constraint from the 3 posts when placing and upgrading within the power grid view.

Method 2

SeqNo int PK
CustomerCode varchar
ProductCode varchar
StoreCode varchar
Quantity int
Note text

My real question is which of these two technique is better? or perhaps is there a different way to do that?

I'd always encourage you to employ Method 2. It can make existence easier. The word for your type of primary secret is a Surrogate Key, instead of an all natural key which is dependant on other fields that have another purpose apart from as being a primary key. You are able to still enforce a distinctive constraint around the 3 foreign key fields in the database level without needing to rely on them however key.

Possess a read want to know , http://www.wingenious.com/article1.html after which if you are looking at this, this is a number of articles on a single subject: http://www.wingenious.com/articles.html