G
Guest
I inherited a SQL database for which I am building a .NET C# web front-end.
The tables have a Timestamp column, called "ts", that I thought I might as
well use for optimistic concurrency.
I'm going VS 2005 all the way, so I have TableAdapter as my DAL that
contains DBDirect methods. The TableAdapter is used from my BLL, a class
library. My aspx page contains a GridView that uses an ObjectDataSource to
the BLL.
I've seen Scott Mitchell's wonderful tutorials on the asp.net site that
detail building a BLL to a DLL, etc. His examples don't use Timestamp columns
for updating and deleting, however, and neither do any of the other examples
I could find on the web. That is where my confusion comes in, to wit:
1. The DBDirect methods created for Update and Delete have a parameter "int
original_PK", which I get. But they also have "byte[] IsNull_ts" and a
"byte[] Original_ts" parameters. The Orignal_ts must be what it sounds like,
the Timestamp value that was retrieved when the record was read. But what is
IsNull_ts? I don't understand that naming convention. If it is the "new"
value, I don't get it because Timestamp values are auto-generated by SQL and
I would never update them.
2. How should I handle the Timestamp on the aspx page? I created a bound
column for it and set Visible to false, thinking that I would preserve the
value for Original_ts on the update. But when the GridView calls my BLL
Update, it passes a null value back for ts.
3. Maybe the logic will clear itself up when I understand the IsNull_ts
parameters, but just in case... It seems to me that for both Update and
Delete, I should first read the current data values so I can get the ts, then
compare it to the Original_ts I saved on my aspx page. Only if they are the
same should I issue the update/delete.
Many thanks,
Ray
The tables have a Timestamp column, called "ts", that I thought I might as
well use for optimistic concurrency.
I'm going VS 2005 all the way, so I have TableAdapter as my DAL that
contains DBDirect methods. The TableAdapter is used from my BLL, a class
library. My aspx page contains a GridView that uses an ObjectDataSource to
the BLL.
I've seen Scott Mitchell's wonderful tutorials on the asp.net site that
detail building a BLL to a DLL, etc. His examples don't use Timestamp columns
for updating and deleting, however, and neither do any of the other examples
I could find on the web. That is where my confusion comes in, to wit:
1. The DBDirect methods created for Update and Delete have a parameter "int
original_PK", which I get. But they also have "byte[] IsNull_ts" and a
"byte[] Original_ts" parameters. The Orignal_ts must be what it sounds like,
the Timestamp value that was retrieved when the record was read. But what is
IsNull_ts? I don't understand that naming convention. If it is the "new"
value, I don't get it because Timestamp values are auto-generated by SQL and
I would never update them.
2. How should I handle the Timestamp on the aspx page? I created a bound
column for it and set Visible to false, thinking that I would preserve the
value for Original_ts on the update. But when the GridView calls my BLL
Update, it passes a null value back for ts.
3. Maybe the logic will clear itself up when I understand the IsNull_ts
parameters, but just in case... It seems to me that for both Update and
Delete, I should first read the current data values so I can get the ts, then
compare it to the Original_ts I saved on my aspx page. Only if they are the
same should I issue the update/delete.
Many thanks,
Ray