在sql server中保存字节数组 [英] Save byte array in sql server

查看:163
本文介绍了在sql server中保存字节数组的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我希望使用一种方法来保存需要使用字节数组的密码,如本 发布

Am looking to use an approach in saving passwords that requires using byte array as in this post

那么我应该在 sql server 中使用哪种数据类型来保存字节数组?以及如何使用 SqlCommand 传递和检索字节数组?

So which data type should i use in sql server to save byte array? and how can i pass and retrieve the byte array using SqlCommand?

推荐答案

如果它总是相同的长度,那么 binary(length) 将是合适的.如果它的长度会有所不同,请使用 varbinary(maxlength).

If it's always going to be the same length, then binary(length) would be suitable. If it's going to vary in length, use varbinary(maxlength).

二进制和 varbinary.

而且,正如@p.s.w.g 所说,您可以通过将其放入合适的参数中来从代码中传递它.

And, as @p.s.w.g says, you pass it from code by placing it into a suitable parameter.

这篇关于在sql server中保存字节数组的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆