how to convert SQL Sever rowversion to long in c#?

Rashmi
Rashmi
1068 Points
19 Posts

I'm working sql server base with rowversion logic. It's easy to convert long in T-SQL but how to convert it to long in c#?

Views: 250
Total Answered: 1
Total Marked As Answer: 1
Posted On: 02-Feb-2024 00:22

Share:   fb twitter linkedin
Answers
Priya
Priya
1194 Points
33 Posts
         

Was resolved long ago. Found something same here: https://copyprogramming.com/howto/rowversion-transact-sql

 

byte[] SqlTimeStamp;
long longConversion;
longConversion = BitConverter.ToInt64(SqlTimeStamp,0);
TimeStamp = BitConverter.GetBytes(longConversion);

ulong ulongConversion;
ulongConversion = BitConverter.ToUInt64(SqlTimeStamp,0);
TimeStamp = BitConverter.GetBytes(ulongConversion);
Posted On: 05-Feb-2024 08:24
Thanks
 - Rashmi  07-Apr-2024 22:36
 Log In to Chat