C# 中如何获得 NEWSEQUENTIALID() 值
获取newid值可以用Guid.NewGuid()方法,获取NEWSEQUENTIALID()值该怎么办呢
我环境是VS2008+sql2008
------解决方案--------------------
可以参考代码
http://www.shirmanov.com/2010/05/generating-newsequentialid-compatible.html
另外
NEWSEQUENTIALID 是对 Windows UuidCreateSequential 函数的包装。你还可以这样
protected void btn_Click(object sender, EventArgs e)
{
Guid dd;
UuidCreateSequential(out dd);
Console.Write(dd.ToString());
}
[System.Runtime.InteropServices.DllImport("rpcrt4.dll", SetLastError = true)]
static extern int UuidCreateSequential(out Guid guid);