|
|||
Can any one please tell me how to retrieve image that i have stored in SQL SERVER 2000 and display the image in datagrid in VB.net 2003? I am able to display text data in datagrid but the picture cannot be display (in datagrid the picture is not shown but it display byte array[]).
|
|
|||
mkmhmt, is my friend id, i forgot to login b4 posting...
ok, u need to do it in the old asp style. i'm not sure i can explain it here but, u need to tweak your aspx file. it depend on what type of control u are using, ie: datagrid or something else. whatever you do make sure on the processes page the IMG tag src point to your image streamer. ie: <IMG src="getImage.aspx?id=1"> your streamer = getImage.aspx, must contains code to stream to http something like Dim oImg As System.Drawing.Image Dim ms As New System.IO.MemoryStream 'assign the image from database to ms here 'enable the following lines to give a default image If ms Is Nothing Then oImg = System.Drawing.Image.FromFile(Server.MapPath("~/Images/") & "Sunset.jpg") ms = New System.IO.MemoryStream oImg.Save(ms, System.Drawing.Imaging.ImageFormat.Jpeg) End If 'this is the real streamer If Not ms Is Nothing Then Response.Clear() Response.ContentType = "image/pjpeg" Response.AddHeader("Content-Length", ms.Length.ToString) Response.BinaryWrite(ms.ToArray) Response.Flush() End If |
![]() |
«
Previous Thread
|
Next Thread
»
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
All times are GMT +8. The time now is 04:40 PM.
Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
LinkBacks Enabled by vBSEO 3.1.0 vBulletin skin by ForumMonkeys.com.










Linear Mode
