Store a Byte array in SQL Server

Smallville

Member
Joined
Jul 7, 2005
Messages
7
Programming Experience
1-3
Hi,

I am trying to store a Byte() array in SQL Server ina field of type varbinary.

The problem that I am having is that in a simple SQL like Select I cannot specify things like:

VB.NET:
[size=2]cmdQuery.CommandText = "Select Name, Password from USERS where Name = " & EncryptUser & " And Password = " & EncryptPwd

[/size]

where EncryptUser and EncryptPwd are byte arrays.

Then I wanted to do something like:

VB.NET:
[size=2]cmdQuery.CommandText = "Select Name, Password from USERS where Name = @EncryptUser And Password = @EncryptPwd"

[/size]

but i have no idea about how to proceed from here.

Does anyone have an idea about it?

Thank you in advance,
Kind Regards,
 
Using that second option, the next thing to do would be to create and append SQLParameter(s) to the command, giving each one its value.

- Let me dig up an example... I don't use the normal methods for this so it'll take some digging. -

Tg
 
Back
Top