Question

Locked

uploading/retrieving photo from vb.net form to sql server database

By sosabou ·
How do i upload a photograph(passport)photo from a vb.net form to my database (sQL Server 2005)

This conversation is currently closed to new comments.

2 total posts (Page 1 of 1)  
| Thread display: Collapse - | Expand +

All Answers

Collapse -

Well first step

by Tony Hopkinson In reply to uploading/retrieving phot ...

is to get the Image, bitmap, png, into a stream.
Then you get that into an array of bytes


Then you create SQLCommand object and set query to something like

'Update MyPhotos Set Photo = @Photo Where PersonID = @Person'

That gives you a parameterised query

Then you create and add the parameters

SQLParameter param = new SqlParameter("@Photo", SqlDbType.Image);
command.Parameters.Add(param);
param.Value = ImageAsByteArray

Set up the where parameter
and execute the command.

Bit c# ish, because I don't use VB.net, but the .Net stuff is the same.

PIA isn't it.

Back to Networks Forum
2 total posts (Page 1 of 1)  

Related Discussions

Related Forums