[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Access (ROWID) Unique ID from Datagrid Column

Mona Syed

6/1/2004 4:52:00 PM

Hi All,



In my application, I read from a DB2 table (using ODBC), fill a Dataset and
then bind it to a ASP.Net Datagrid for display to the user. The primary key
of the table that I read is a DB2 data-type of ROWID (which is an
auto-generated unique ID that DB2 generates/maintains). The ROWID column in
my datagrid is hidden (Visible=False). Here is a brief definition of DB2's
ROWID data-type:

A row ID is a value that uniquely identifies a row in a table. A column or a
host variable can have a row ID data type. A ROWID column enables queries to
be written that navigate directly to a row in the table. Each value in a
ROWID column must be unique, and DB2 maintains the values permanently, even
across table space reorganizations. When a row is inserted into the table,
DB2 generates a value for the ROWID column unless one is supplied. If a
value is supplied, it must be a valid row ID value that was previously
generated by DB2 and the column must be defined as GENERATED BY DEFAULT.
Users cannot update the value of a ROWID column.

The internal representation of a row ID value is transparent to the user.
The value is never subject to translation because it is considered to
contain BIT data. The length of a ROWID column as described in the LENGTH
column of catalog table SYSCOLUMNS is the internal length, which is 17
bytes. The length as described in the LENGTH2 column of catalog table
SYSCOLUMNS is the external length, which is 40 bytes.

This application is supposed to allow update of values in the datagrid
columns.



When the user places a check-mark in a given datagrid row to indicate update
(hotmail style), I need to apply the update to the underlying Dataset (using
the ROWID as the unique identifier), then have the Dataset ultimately
resolve the changes to the DataSource which is the DB2 table.



My problem is, I can't seem to get the ROWID out of the Datagrid column.
Because of the translation that DB2-Connect performs, the ROWID comes over
as a Byte array (System.Byte[]). When the given row is in a dataset row, I
can Response.Write the contents of the ROWID which look something like (10
160 244 66 222 .. ... .. .. For 22 bytes), but I can't do anything with it
when the same row is being displayed in a datagrid.



If anyone knows how to access/convert a DB2 ROWIDs from an ASP.Net's
datagrid, I would really appreciate your help.



OR



As an alternative, is there a way that I can forget about the DB2 ROWID and
temporarily generate my own unique IDs in ASP.Net ( as the rows are being
filled to the Dataset ?? ) and then use this unique ID for updating the rows
and resolving the changes to the DB2 database ??



The table I am working with did NOT have a unique ID, so we tacked on the
ROWID field, but it's giving me problems. Please help if you can.



Mona Syed