B
Brian Korenaga
Have tried a couple of different methods to update dataset timestamp
after SQL 2000 update (batch query and sproc output parameter).
I've tried both methods using ADO .NET by David Sceppa (Chapter 11) as
an example. I've examined the timestamp before and after the update
and it is unchanged.
1. I created DataAdapter through IDE.
2. I know using the batch query method that SQL is passing back the
new timestamp (using Query Analyzer).
3. I've tried both separate and combined parameters for the timestamp
(i.e. oldtimestamp as input, newtimestamp as output or timestamp as
input/output).
4. I've assigned the parameters to the timestamp column in the
datatable (DataSource) and have tried both using Current and then
Original as SourceVersion.
5. Dataset will update once (Data changes in SQL, but SQL generated
timestamp doesn't get back to the dataset).
Abbreviated stored procedure (using separate parameters):
Create Procedure UpdateHousehold
@BuildingId uniqueidentifier,
..
..
@OldTStamp timestamp,
@NewTStamp timestamp OUTPUT
AS
UPDATE Household ...
WHERE (BuildingId = @BuildingId) AND (TStamp = @OldTStamp);
If @@Rowcount = 1
Select @NewTStamp = TStamp From Household Where BuildingId =
@BuildingId
IDE Generated code
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@OldTStamp",
System.Data.SqlDbType.VarBinary, 8,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)),
((System.Byte)(0)), "TStamp", System.Data.DataRowVersion.Original,
null));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@NewTStamp",
System.Data.SqlDbType.VarBinary, 8,
System.Data.ParameterDirection.Output, false, ((System.Byte)(0)),
((System.Byte)(0)), "TStamp", System.Data.DataRowVersion.Original,
null));
this.sqlUpdateCommand1.UpdatedRowSource =
System.Data.UpdateRowSource.OutputParameters;
I know other people have go this to work, but I am at a total loss.
Any body have any ideas?
Thanks,
Brian
after SQL 2000 update (batch query and sproc output parameter).
I've tried both methods using ADO .NET by David Sceppa (Chapter 11) as
an example. I've examined the timestamp before and after the update
and it is unchanged.
1. I created DataAdapter through IDE.
2. I know using the batch query method that SQL is passing back the
new timestamp (using Query Analyzer).
3. I've tried both separate and combined parameters for the timestamp
(i.e. oldtimestamp as input, newtimestamp as output or timestamp as
input/output).
4. I've assigned the parameters to the timestamp column in the
datatable (DataSource) and have tried both using Current and then
Original as SourceVersion.
5. Dataset will update once (Data changes in SQL, but SQL generated
timestamp doesn't get back to the dataset).
Abbreviated stored procedure (using separate parameters):
Create Procedure UpdateHousehold
@BuildingId uniqueidentifier,
..
..
@OldTStamp timestamp,
@NewTStamp timestamp OUTPUT
AS
UPDATE Household ...
WHERE (BuildingId = @BuildingId) AND (TStamp = @OldTStamp);
If @@Rowcount = 1
Select @NewTStamp = TStamp From Household Where BuildingId =
@BuildingId
IDE Generated code
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@OldTStamp",
System.Data.SqlDbType.VarBinary, 8,
System.Data.ParameterDirection.Input, false, ((System.Byte)(0)),
((System.Byte)(0)), "TStamp", System.Data.DataRowVersion.Original,
null));
this.sqlUpdateCommand1.Parameters.Add(new
System.Data.SqlClient.SqlParameter("@NewTStamp",
System.Data.SqlDbType.VarBinary, 8,
System.Data.ParameterDirection.Output, false, ((System.Byte)(0)),
((System.Byte)(0)), "TStamp", System.Data.DataRowVersion.Original,
null));
this.sqlUpdateCommand1.UpdatedRowSource =
System.Data.UpdateRowSource.OutputParameters;
I know other people have go this to work, but I am at a total loss.
Any body have any ideas?
Thanks,
Brian