Mario said:
First question: If I don't want to end user see ID column, for
example if the column is uniqueidentifier it is unnecessary for end
user. How and where to hide or remove that column which is necessary
for queries which insert update and delete from the table?
You have to turn off the automatic column generation bits with any of
the .NET drag and drop controls. After that, you can define what the
user does and does not see. If the info is important, you simply set it
up as the key for the "row" and you can still get it when the page
submits back.
I will have to find a code sample of this and post.
Second: How to add column with row numbers read only data?
read only data or row numbers as read only? Not sure I am getting the
question.
The row number can be pulled with any interaction, so you need never
expose it. The ID, as stated above, can be made the key for the "row",
so that is not an issue.
Read only is not an issue as you simply do not allow editing of the
item.
Thrid: Is it out of best practice to put primary key on article column
? Why examples always start with ID column which is int or
uniqueidentifier?
In general, in datbase design, the primary key is some form of numeric
and is NOT human readable data. This is not true for all database
systems, but it is both
a) more efficient
b) Less likely to end up with data problems from human intervention
when the key is derived and has no real bearing on the data. This is why
most SQL Server/Oracle/Postgress/etc (RDBMS) developers create derived
keys. In SQL Server, the most common are IDENTITY fields (some type of
integer) and row GUIDS because both can be auto-generated.
The problem with non-derived keys is there comes a time when the actual
"key" ends up changing, if only for one individual, which means you have
to create a mechanism to change it throghout the database. If this is
only one individual, it is a lot of work for little gain. Even when it
is common, it is dangerous.
Peace and Grace,
--
Gregory A. Beamer (MVP)
Twitter: @gbworld
Blog:
http://gregorybeamer.spaces.live.com
*******************************************
| Think outside the box! |
*******************************************