Posts filed under ‘ADO.Net’
Read RowStamp column value from the SQL Database
Hey! have you ever face the problem to read the Value of“RowStamp” data type column.
When you read value through the datareader you will have that value in the data reader but in the .net Row stamp is treated as thearray of Byte types
so you need to read the value of reader by
GetSqlBinary(columnindex) method and also needs to convert to Array of bytes then it will work.
Cheers..
Raise DBConcurrency Exception FROM DataAdapter
Hello!
In .Net Ado.net provides many features of database operation and also you can have disconnected architecture so you have good performance.
But for Concurrency you have to take care of one thing.
When you have used stored procedure for command and want to raise DBConcurrency Exception then it will not raise.
For that you have to set
SET NOCOUNT OFF; in stored procedure.
Then when you are going to update dataset with DataAdapter’s update method. It will raise DBConcurrency Error If no row is affected in stored procedure.
Please do this by testing. As just set SET NOCOUNT ON and same code will not generate any Exception.
This little thing will save many time to handle concurrency and also reduce many line of code.