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

Rashmi
Rashmi
Member
820 Points
17 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: 75
Total Answered: 1
Total Marked As Answer: 0
Posted On: 02-Feb-2024 00:22

Share:   fb twitter linkedin
Answers
Priya
Priya
Participant
936 Points
28 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
 Log In to Chat