Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Sequence GUID
Message
De
08/05/2009 09:18:05
 
 
À
08/05/2009 04:25:30
Information générale
Forum:
ASP.NET
Catégorie:
Code, syntaxe and commandes
Titre:
Versions des environnements
Environment:
C# 3.0
OS:
Windows Server 2008
Network:
Windows 2008 Server
Database:
MS SQL Server
Application:
Web
Divers
Thread ID:
01398391
Message ID:
01398593
Vues:
69
>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);
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform