Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the equivalent type of SQL Timestamp in c#

We have a recordversion column (Something like 0x00000000006EC935) of type timestamp in SQL. Want to have it as a string in c# code. What is equivalent type? How to convert?

like image 684
Payman Avatar asked Sep 07 '25 10:09

Payman


1 Answers

You can map Timestamp type in sql to Byte[] in .net.

you can convert string rowVersion to byte[] and vise versa like this:

    // string rowVersion To Byte[]
    byte[] byt = System.Text.Encoding.UTF8.GetBytes(strOriginal);

    // Byte[] rowVersion to string

    strModified = Convert.ToBase64String(byt);
like image 72
farid salehi Avatar answered Sep 10 '25 03:09

farid salehi