Extracting Image from sql server 2000 db

Rani

Well-known member
Joined
Nov 19, 2005
Messages
71
Programming Experience
Beginner
I am new to web world. please give me a descriptive suggestion.

what would be the best way to extract and display images from database.
I would be using visual studio.net for creating pages and sql server 2000 for database.

Also, how and where would i store the images? either the web directory and path in db OR image itself in the database?

Also what size is adviseable?


Thanks/Rani
 
Thanks very much for directing me thru.
I tried both the samples however, two things are happening.

1. first example "Save to db from file" works for the id and description fields but imgfield it does not put the image Gone fishing.bmp instead, it just says <Binary>.

2. second example "Save to File from DB" I first got an error on line
dim mydata as byte
This is the error "Value of type byte cannot be converted to 1-dimension"
so i changed dim mydata as array.

I now get the error on line
Dim fs As New FileStream("C:\windows\Gone Fishing2.BMP", FileMode.OpenOrCreate, FileAccess.ReadWrite)
This is the error i get
"Access to the path "C:\windows\Gone Fishing2.BMP" is denied. "

Can you please suggest. Thanks/Rani
 
1) It says "Binary" because that is what the data is.... You have to extract it and write it to a file in order to see it.

2) Write to a different directory. Like the Application.StartupPath & "\images" folder or something. Really should be writing this kind of data into the the Windows dir. ... Or into the Temp dir at least.

-tg
 
I tried this path i got the error below in red.

Dim fs As New FileStream("C:\Inetpub\wwwroot\PractiseGiftCert\Image\Christmastree.bmp", FileMode.OpenOrCreate, FileAccess.ReadWrite)
Access to the path "C:\Inetpub\wwwroot\PractiseGiftCert\Image\Christmastree.bmp" is denied.


However, when i tried
Dim fs As New FileStream("c:\rani\Mo.bmp", FileMode.OpenOrCreate,FileAccess.Readwrite)

I was able to write to the database and write to a temp folder.
I still do not know how to write images to the web directory folder or db from the web folder.

Rani

 
Back
Top