如何在sql server中对guid进行base64编码
如何在 sql server 2005 中使用 uniqueidentifier 数据类型重新创建以下 c# 代码。
string encoded = Convert.ToBase64String(guid.ToByteArray());
我尝试了在互联网上遇到的几个示例,例如 http://www.vbforums.com/showthread.php?t=554886 但它们都返回比.net 功能。
How can I re-create the following c# code with a uniqueidentifier datatype in sql server 2005.
string encoded = Convert.ToBase64String(guid.ToByteArray());
I have tried several examples I came across on the internet such as http://www.vbforums.com/showthread.php?t=554886 but they all return strings much longer than the .net function.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
标识符,则链接中的示例有效
唯一
如果您传入And
for 的
The sample in your link works if you pass in a uniqueidentifier
for
And
for
我的 guid 位于名为“guid”的 nvarchar(MAX) 列中,看起来像这样
采取几个步骤,即显示我的工作。我在表 guidreal、guidbinary、guidbase64 中添加了三列。我意识到这可以被压缩:-)。
1.
2.
3.
这让我
使用以下命令解码回 varbinary
my guid's was in a nvarchar(MAX) column named 'guid' and looked like this
Taking a few steps i.e. showing my working. I added three columns to my table guidreal, guidbinary, guidbase64. I realise this can be compressed :-).
1.
2.
3.
which gave me
decode back to varbinary using
我可能是错的,但我认为这是不可能的。
C# 端的算法与您在 sql 部分中找到的任何组合都不同。
为了解决这个问题,我建议将所有事情都集中在一侧。即:从 C# 端填充数据库或在 sql 部分执行所有操作。
I might be wrong but I think it's not possible.
The algorithm in C# side is different from whatever combination you may find in sql part.
To solve this, what I recommend is to do all in one side. i.e.: populate the db from the c# side or do all in the sql part.