|
-
February 12th, 2010, 07:17 AM
#1
[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
Last edited by 1druid1; February 15th, 2010 at 06:26 AM.
Reason: Answer Solved
-
February 12th, 2010, 08:34 AM
#2
Re: Storing a picture in SQL 2000
-
February 15th, 2010, 02:57 AM
#3
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
-
February 15th, 2010, 05:21 AM
#4
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"
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
February 15th, 2010, 06:25 AM
#5
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
-
February 15th, 2010, 06:35 AM
#6
Re: [RESOLVED] Storing a picture in SQL 2000
you're welcome
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
February 15th, 2010, 10:46 AM
#7
Re: [RESOLVED] Storing a picture in SQL 2000
Thought the problem may be with the size of the picture, sorry Dougie. 
Just shows, a person always think a problem is "Very complicated", but mostly isn't
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|