A SQL server timestamp is a 8 Byte array so you can retrieve it with a property like this

public Byte[] Version
{
get { return _version; }
set { _version = value; }
}



On 8/3/05, Shawn Smiley <[EMAIL PROTECTED]> wrote:
How do I use a SQL Server 2000 Timestamp/Rowversion
field with iBatis to provide concurency checks during
updates/deletes?

I've added the field to all of my table, added a
byte[] property for the Rowversion to all of my C#
Objects, and finally have updated the statement and
map xml entries to include the field.

I get one of two errors depending on how I structure
my statement:

With: DELETE FROM Tablename WHERE ID=#ID# AND
Version=#Version#

I get a cannot convert from nvarchar to timestamp
error.

If I change the SQL to: DELETE FROM Tablename WHERE
ID=#ID# and Version=CONVERT(TIMESTAMP, #Version)

I don't get an error, but the record is not deleted.


Any suggestions on what I'm missing here?

Thanks,
Shawn.

__________________________________________________
Do You Yahoo!?
Tired of spam?  Yahoo! Mail has the best spam protection around
http://mail.yahoo.com

Reply via email to