converting sql server rowversion to long or ulong?

后端 未结 4 775
隐瞒了意图╮
隐瞒了意图╮ 2020-12-18 21:14

What is the proper type for the rowversion (timestamp) data type?

I know it is 8 bytes but i cannot find a link in MSDN which tell if it is a signed or unsigned long

4条回答
  •  Happy的楠姐
    2020-12-18 22:02

    I use this (updated):

    private UInt64 GetUInt64ForRowVersion(byte[] rowVersion)
    {
        byte[] rr = (byte[])rowVersion.Clone();
        if (BitConverter.IsLittleEndian) { Array.Reverse(rr); }
        return BitConverter.ToUInt64(rr, 0);
    }
    

提交回复
热议问题