Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Sequence GUID
Message
From
08/05/2009 09:18:05
 
 
To
08/05/2009 04:25:30
General information
Forum:
ASP.NET
Category:
Coding, syntax and commands
Title:
Environment versions
Environment:
C# 3.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Miscellaneous
Thread ID:
01398391
Message ID:
01398593
Views:
68
>Hi,
>Thank you for info.
>
>I tried to convert the COMB logic to C#, but not successfully. Do you know how to convert the below to C#?
>
>
>CAST(CAST(NEWID() AS BINARY(10)) 
>+ CAST(GETDATE() AS BINARY(6)) AS UNIQUEIDENTIFIER)
>
>
>Thank you
I *think* this would do it (but verify that the result is as expected)
Byte[] b = Guid.NewGuid().ToByteArray();
Byte[] x = System.BitConverter.GetBytes(DateTime.Now.Ticks);
// Or maybe: Byte[] x = System.BitConverter.GetBytes((UInt64)DateTime.Now.ToBinary());
Byte[] result = new Byte[16];
Array.Copy(b, 0, result, 0, 10);
Array.Copy(x, 0, result, 10, 6);
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform