将字节数组保存在SQL Server中 [英] Save byte array in sql server
本文介绍了将字节数组保存在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)
.
而且,正如@ 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屋!
查看全文