I'm developing a web application where I need to have concurrency control in updation. I was tyring to achieve this with the SQL Server build in datatype TIMESTAMP but for some reason I'm not able to acheive it with this.
I'm using this code but at no point of time I'm able to successfully update a record (even if there is only one usre who makes an update). TS is the timestamp colum in the table and I'm making a parameterized query to update this.
sql = "UPDATE Request SET Flag = 'A' WHERE RequestID = @RequestID AND TS = @TS";
myParams = new SqlParameter("@Flag", SqlDbType.Char);
myParams.Value = mFlag.Trim();
myParams = new SqlParameter("@TS", SqlDbType.Timestamp);
myParams.SourceVersion = DataRowVersion.Original;
myParams.SourceColumn = "TS";
' Prepare a command cmd and execute
But with this method, the update never succeeds at any point of time. Is there anything I'm missing or making wrong? Any other way to do it? Pls help me, am struck.