[RESOLVED] Storing a picture in SQL 2000
Hi All
I have the following code that I use to convert a picture into bytes.
Code:
Dim strImageFilePath As String = _
LblPicture.Text
Dim fsImageFile As New FileStream(strImageFilePath, _
FileMode.Open, FileAccess.Read)
Dim bytImageData(fsImageFile.Length() - 1) As Byte
fsImageFile.Read(bytImageData, 0, bytImageData.Length)
fsImageFile.Close()
This then gets used to store into an SLQL 2000 VarBinary field.
I thought the above would work but its only letting me save pictures that are under 8k in size, but I need to be able to save much bigger files than that.
Any help is appreciated.
Cheers
Dougie
Re: Storing a picture in SQL 2000
Re: Storing a picture in SQL 2000
Hi
Thanks for the reply, the size of the picture depends on the user taking it, although I am going to teach them how to reduce picture sizes, so hopefully 1mb maximum, but the possibility of more would be good. I had written the program to use a file store instead and just link the picture via filename, but it didnt work very well as the users copied, moved deleted pictures, and refernces ended up lost. So I want to store the pictures in the database to get around this problem.
Cheers
Dougie
Re: Storing a picture in SQL 2000
did you already see this?
http://www.vbdotnetheaven.com/upload...sqlserver.aspx
the type of field used to store content in Sql Server 2000 is "Image"
Re: Storing a picture in SQL 2000
Thanks Cimperiali
All I needed to do was change from a VarBinary to an Image field, I didnt even noticce the image field.
Cheers
Dougie
Re: [RESOLVED] Storing a picture in SQL 2000
Re: [RESOLVED] Storing a picture in SQL 2000
Thought the problem may be with the size of the picture, sorry Dougie. :blush:
Just shows, a person always think a problem is "Very complicated", but mostly isn't :)