473,479 Members | 2,128 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

display image from database

while writing an image ... i get the following error
my Code
-------------------------------------------------------------------
Dim imgStream As New MemoryStream()
Dim query As String
query = "select Photo from EmployeeMaster where EmpCode='1'"
Dim bImage As Byte() = CType(SQL.ExecuteScalar(query), Byte())

imgStream.Write(bImage, 0, bImage.Length)

Dim bitmap As New Bitmap(imgStream)
Response.ContentType = "image/jpg"
bitmap.Save(Response.OutputStream, ImageFormat.Jpeg)
-------------------------------------------------------------------
Parameter is not valid.
Description: An unhandled exception occurred during the execution of the
current web request. Please review the stack trace for more information
about the error and where it originated in the code.

Exception Details: System.ArgumentException: Parameter is not valid.

Source Error:
Line 333: imgStream.Write(bImage, 0, bImage.Length)
Line 334:
Line 335: Dim bitmap As New Bitmap(imgStream)
Line 336: Image1.ImageUrl = bitmap.ToString
Line 337:
Source File: F:\Send\BCP\DotNet\Alchemy\adEmployee.aspx.vb Line: 335

Stack Trace:
[ArgumentException: Parameter is not valid.]
System.Drawing.Bitmap..ctor(Stream stream) +262
adEmployee.cmbEmployeeName_SelectedIndexChanged(Ob ject sender, EventArgs
e) in F:\Send\BCP\DotNet\Alchemy\adEmployee.aspx.vb:335
System.Web.UI.WebControls.ListControl.OnSelectedIn dexChanged(EventArgs e)
+96
System.Web.UI.WebControls.DropDownList.RaisePostDa taChangedEvent() +145
System.Web.UI.WebControls.DropDownList.System.Web. UI.IPostBackDataHandler.RaisePostDataChangedEvent( )
+26
System.Web.UI.Page.RaiseChangedEvents() +165
System.Web.UI.Page.ProcessRequestMain(Boolean
includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint) +3536
Rahul
Feb 14 '07 #1
2 4628
i got it .... there was a problem in storing an image in the database....
the code to read and display file is right ....

Rahul
Feb 15 '07 #2
On Feb 15, 8:13 am, "Rahul" <rahula...@hotmail.comwrote:
i got it .... there was a problem in storing an image in the database....
the code to read and display file is right ....
Btw, regarding displaying "dynamic images"...
http://ajaxwidgets.com/AllControlsSa...amicImage.aspx

Click the "Show code" button up left...
Notice the "DynamicImage1_RetrieveImage" event handler method...

..t

--
http://ajaxwidgets.com
Free ASP.NET Ajax Widgets NOW!

Feb 15 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

9
1966
by: Wally | last post by:
I am trying to display images from an Access 2000 database and I get an error "Invalid Parameter Used" when I execute the code line "picBLOB.Image = Image.FromStream(stmBLOBData)" in my Visual...
1
4328
by: John Scott | last post by:
I am storing an image in an SQL database and have one field as an image datatype. I am also using a webservice to transport data. I want to be able to resize the image and pass back a thumbnail...
1
2875
by: Eric Keung | last post by:
Hi all, my case is I want to get an image from access database and I just know it's "OLE object" field type at access I also don't know how to insert it into access here is my code and it just...
5
5014
by: Peter Lapic | last post by:
I have to create a image web service that when it receives an imageid parameter it will return a gif image from a file that has been stored on the server. The client will be an asp.net web page...
3
5221
by: den 2005 | last post by:
Hi everyone, Here is code working on..Trying to insert record with a column with Image or VarBinary datatype in sql database from a existing jpeg image file, then retrieve this image from...
1
2309
by: Objectifnet | last post by:
What I really want to do is to be able to link two pages together using an ID, The table involved displays an image stored on the File Server that has the image details stored in the Database called....
3
6405
by: Dave Keen | last post by:
Hi all. Hope you can help me. This should be easy but I can't make this work. In brief I am building a page of thumbnails using images held in a SQLServer 2000 database. I do this by creating...
7
5381
by: eholz1 | last post by:
Hello Group, Perhaps you can help me. I have a mysql db, that holds images. Images are encoded using base64_decode/encode, etc. Image data seems fine. I have a view.php page that is supposed...
1
2967
by: amritranjan | last post by:
How to retrive image file from MS access database and display this in another JSPpage -------------------------------------------------------------------------------- This is my Jsp code for...
1
2032
by: swethak | last post by:
Hi, I write the code to display images.But it will not display image.And also gives the error like that error : Notice: Undefined index: gim in F:\Facebook\pic_up.php on line 59 plz tell...
0
6899
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7067
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6719
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
5312
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
4463
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
2970
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1288
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
555
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
166
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.