Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DBTimeStamp Concurrency 1

Status
Not open for further replies.

itflash

Programmer
Jul 18, 2001
535
GB

Hi All

I have a last amended date for rows in a table to handle concurrency.

In SQL Server 2000, it is a DateTime type (8) NULLS.

However, I ALWAYS get a concurrency error and it is the date that is causing the problem. Am I doing something wrong with the parameters?

Any ideas would be appreciated.

Code Below:

Thanks
ITflash




The line in the SQL is as follow:

"(lastamendeddate = ? OR ? IS NULL AND lastamendeddate IS NULL); " & _


The parameters for the above line is as follows:

objDA.UpdateCommand.Parameters.Add("@origlastamendeddate", OleDb.OleDbType.DBTimeStamp)
objDA.UpdateCommand.Parameters("@origlastamendeddate").SourceColumn = "lastamendeddate"
objDA.UpdateCommand.Parameters("@origlastamendeddate").SourceVersion = DataRowVersion.Original
objDA.UpdateCommand.Parameters.Add("@origlastamendeddate1", OleDb.OleDbType.DBTimeStamp)
objDA.UpdateCommand.Parameters("@origlastamendeddate1").SourceColumn = "lastamendeddate"
objDA.UpdateCommand.Parameters("@origlastamendeddate1").SourceVersion = DataRowVersion.Original
 
Is there a reason why you're not using the SQL Server "timestamp" data type to track the last-changed info?

The database will update this column for you automatically -- you use it by storing it in your class when you read the record, and when you go to write it back you re-read the row to see if it changed.

Chip H.


If you want to get the best response to a question, please check out FAQ222-2244 first
 


Thanks for that.

Helped me out and refocus.

I used the timestamp, realised this was binary and worked it all out from there.

Cheers
ITflash
[thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top