all groups > sql server programming > october 2004 >
You're in the

sql server programming

group:

can we store image in sql data base without using streams


can we store image in sql data base without using streams kiakamhai NO[at]SPAM yahoo.com
10/4/2004 7:46:58 PM
sql server programming:
hi,

can we store the images in the database without using streams in
vb.net?

is there any way that i store the image without using stream. i
want to store different image formats tiff, bmp, jpg etc many other
types.


Re: can we store image in sql data base without using streams Dan Guzman
10/4/2004 10:17:24 PM
If your images are reasonable in size, you can use regular INSERTs: The
SqlClient example below assumes the image variable is a byte array
containing your image.

Dim command As New SqlCommand("INSERT INTO MyTable VALUES(@MyImage)",
connection)
Dim imageParameter As New SqlParameter("@MyImage", SqlDbType.Binary)
command.Parameters.Add(imageParameter)
sqlParameter.Value = myImage
command.ExecuteNonQuery()

--
Hope this helps.

Dan Guzman
SQL Server MVP

[quoted text, click to view]

AddThis Social Bookmark Button