image datatype in C#

J

Jason Huang

Hi,

I have a PassWord column in SQL Server 2000 which is image datatype.
How do I transfer or decode/encode text to image datatype so that my SQL
Server recongnize it?
Any help will be appreciated.

Jason
 
J

Jason Short

You mean you have a "variable" named PassWord that is an image. The column
names in SQL don't mean anything. You could have called it Pass____Word if
you wanted. Does not even mean that it is used for storing passwords...

If it is an image type then it is probably NOT a password, but an image. If
you are using something internally to reference an image to a password then
I would think you would know how to do it already....
 
C

Cor Ligthert [MVP]

Jason,

An image on the server is nothing more than a ByteArray. Byte[]

Something as roughly typed here
\\\
Byte[] abyt = (Byte[]) ds.Tables[0].Rows[0][0];
IO.MemoryStream ms = new IO.MemoryStream(abyt);
PictureBox1.Image = Image.FromStream(ms);
///

I hope this helps,

Cor
 
J

Jason Huang

Thanks Jason!

In my application I have 2 TextBox, one is txtUserID, the other one is
txtPassWord.
When the user login the AP, it then will check if the UserID and PassWord
match the corresponding data in SQL Server 2000,
where the data column UserID is varchar, and the data column PassWord is
image.
 
K

Kevin Spencer

Hi Jason,

You just insert it into the column. Example:

INSERT INTO Password (passwordImageColumn) 'YourPassword'

--
HTH,

Kevin Spencer
Microsoft MVP
..Net Developer
Big things are made up of
lots of little things.

System.Text.Encoding enc = System.Text.Encoding.Default;
byte[] bytes = enc.
 
I

Ignacio Machin \( .NET/ C# MVP \)

Hi,
If it is an image type then it is probably NOT a password, but an image.
If you are using something internally to reference an image to a password
then I would think you would know how to do it already....

An Image in SQL can be used to store any binary data, probably the OP is
hashing or encrypting the text in binary form and storing that in the DB


cheers,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top