Hi Charlie,
I wanted to ask,
How is the bitmap stored in the database? as a Blob or in bytes?
if it is stored in bytes, then I feel that Blob/Image is the better option.
you can insert the byte array as I mentioned before in the Image field of
the database.
For retrieving and displaying the image, put the byte array into a stream
and then create a bitmap file from the stream.
----------------------------------------------------------------------
MemoryStream stream = new MemoryStream(RawData, true);
stream.Write(RawData, 0, RawData.Length);
Bitmap bmp = new Bitmap(stream);
stream.close();
---------------------------------------------------------------------
Hope this helped
++Vijay R
:
Hi,
I think this should work just for converting the bitmap to a byte stream:
--------------------------------------------------------------------
FileStream Fs = new
FileStream(TextBox2.Text.Trim(),FileMode.Open,FileAccess.Read);
byte[] RawData = new byte[Fs.Length];
Fs.Read(RawData,0,Convert.ToInt32(Fs.Length));
Fs.Close();
Session.Add("FileData",RawData);
-------------------------------------------------------------------
Now assuming that the file format is always bmp, we have to work on
converting it back into bmp.
will work on this
++Vijay R
:
Thanks Vijay,
As simple as this might sound, it's taking me forever. Could you pls point
me to some sample code?
The sample code i find, requires that i know the size and file type of the
image (bitmap) in the database, which i might not... I don't seem to find a
sample which is as "simple" as your solution seems to imply.
thanks
:
Hi,
Why not covert the Image to Binary and then store it in session with the Img
format?
Is this a bad idea?
++Vijay R
:
Why not? Check out the Bitmap class.
Hello -
I have images saved in my SQL SERVER 2000 database. Using ASP.NET (C#)
is there any way to temporarily save an image to a session object, and
after running some other operations, later retrieve the image from the
session object, convert it back to an image, and re-save it to the
database?
Thanks?