freelanceprogrammers.org Forum Index » ASP

Image Binding


View user's profile Post To page top
dhivya_mn Posted: Thu Jan 19, 2006 1:53 pm


Joined: 19 Jan 2006

Posts: 1
Image Binding
Hi,


Can anybody please help me out with the problem of
binding the image which is stored in the Database(MS
SQL)to Asp.Net Web page?

Thanks,
Dhivya.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
Reply with quote
Send private message
View user's profile Post To page top
kindawords Posted: Thu Jan 19, 2006 6:10 pm


Joined: 11 Jan 2006

Posts: 46
Image Binding
There are a couple of ways to do it, but a quick and dirty way is to
create an aspx that simply outputs the image. You can then use this
page as the image source.

ImagePage.aspx code...

Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
Dim dr As SqlDataReader
dr = SomeFunctionThatReturnsADataReader

If dr.Read() Then
Response.ContentType = dr("ImageType").ToString()
Response.BinaryWrite(dr("ImageData"))
End If
dr.Close()
End Sub

Then in your other page....

<img src="ImagePage.aspx" >

If you want to get fancier, you can create an HttpHandler that creates
the image directly. To see an example of this, check out the ASP.NET
Community Starter Kit



On 1/19/06, dhivya murugan <dhivya_mn@...> wrote:
> Hi,
>
>
> Can anybody please help me out with the problem of
> binding the image which is stored in the Database(MS
> SQL)to Asp.Net Web page?
>
> Thanks,
> Dhivya.
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam? Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
>
>
> Yahoo! Groups Links
>
>
>
>
>
>
>


--
Dean Fiala
Very Practical Software, Inc
http://www.vpsw.com
Reply with quote
Send private message
View user's profile Post To page top
email2saputra Posted: Tue Jan 24, 2006 5:36 pm


Joined: 12 Jan 2006

Posts: 4
Image Binding
Dear Dean,
Thursday, January 19, 2006, 7:10:29 PM, you wrote:
> There are a couple of ways to do it, but a quick and dirty way is to
> create an aspx that simply outputs the image.  You can then use this
> page as the image source.

> ImagePage.aspx code...

> Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
> System.EventArgs) Handles MyBase.Load
>    Dim dr As SqlDataReader
>         dr = SomeFunctionThatReturnsADataReader

>         If dr.Read() Then
>            Response.ContentType = dr("ImageType").ToString()
>            Response.BinaryWrite(dr("ImageData"))
>         End If
>         dr.Close()
> End Sub

> Then in your other page....

> <img src="ImagePage.aspx" >

> If you want to get fancier, you can create an HttpHandler that creates
> the image directly.  To see an example of this, check out the ASP.NET
> Community Starter Kit



> On 1/19/06, dhivya murugan <dhivya_mn@...> wrote:
>> Hi,
>>
>>
>>   Can anybody please help me out with the problem of
>> binding the image which is stored in the Database(MS
>> SQL)to Asp.Net Web page?
>>
>> Thanks,
>> Dhivya.
Reply,
or u can save image filename ( use GetFileName function ) as new field to
database and set it
to database.

FileName = myDataReader("FileName")

<% Response.Write("<img src=" & FileName & ">" )

Best regards,
Surya A. Saputra

http://www.saputra.co.nr

__________________________________________________
Apakah Anda Yahoo!?
Lelah menerima spam? Surat Yahoo! memiliki perlindungan terbaik terhadap spam
http://id.mail.yahoo.com
Reply with quote
Send private message
Post new topic Reply to topic
Display posts from previous:   
 

All times are GMT
Page 1 of 1
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Freelace Website Designer - Customer web design and software building.
Booking Calendar - reservation calendar script
Land Surveying - total station instruments and equipments
China Wholesale - Electronics Products
Character Studio - Tutorials and Help