List Info

Thread: RE: Error displaying images in gridview




RE: Error displaying images in gridview
country flaguser name
United States
2008-04-18 04:28:24
Why not store the image in the file system?


On Apr 18, 2008, at 3:21, "dipak mishra"
<mishradipakgmail.com> wrote:

Dear Allen,
I am storing Image itself in database not the path to it.
How to display that using image field.
I am not able to do so.
Plz Help

On 4/18/08, Allen Moon <howlmoonclearwire.net> wrote:
Hey there
In ASP 2.0 there is a ImageField in gridview that you need
to use.

-----Original Message-----
From: dipak mishra [mailto:mishradipakgmail.com]
Sent: Thursday, April 17, 2008 1:15 PM
To: aspnet-databasesaspadvice.com
Cc: aspnet-databasesaspadvice.com
Subject: [aspnet-databases] Error displaying images in
gridview

Hi All,
I am facing a problem on which i would like to have
suggestions.
I have an ERP Application in ASP.net 2.0 with sql 2005 as
back end. I am
storing images in database then i am displaying it on a page
and giving the
URL of  that page in grid view template field which has a
image control.
Same thins i have been doing in application developed in asp
1.0 and sql 7.0
the images are displayed correctly everywhere.
But in this application in Grid view the same image have
stopped being
displayed. Although if i view them individually on other
page they are
displayed correctly.
The client has genuine sql server.with service pack 2. Same
things are
working fine on my development machine and similar thing is
running fine in
asp 1.0 and sql 7.0.
It was running fine on this clients system too. All of a
sudden this is not
displaying image in grid view.
I have reinstalled sql2005 still same problem.
The images are saved in sql 2005 this i have checked also
the images are
displayed correctly individually which proves images are in
fact saved
actually.
Any help will be graetly appreciated since i am stuck
Regards
Dipak



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com




Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com




Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com



Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com



     
____________________________________________________________
________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9
tAcJ


Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com

RE: Error displaying images in gridview
country flaguser name
United States
2008-04-18 07:15:15
you'd need a query string for a path that points to a page with a primary key.  the page should do a read out of the database and do a binary write with a mime type of jpg or whatever.
 
(FetchImage.aspx page)
&nbsp;
Sub Page_load(...)
&nbsp; &nbsp; dim pk as Integer = Request.QueryString("pk")
&nbsp; &nbsp;  - set the mimetype of the output&nbsp; (Response.ContentType="application/jpg"
&nbsp;   Try
&nbsp;
 &nbsp;   ; &nbsp;  - connect to database
 &nbsp; &nbsp; &nbsp; &nbsp; - initializeCommand to call stored procedure and return datatable
 &nbsp; &nbsp; &nbsp;   - read the 'bits' out of the field into a byte array
&nbsp; &nbsp;   ; &nbsp; - check if bytearray.length = 0 or datatable.rows.count = 0
   ; &nbsp; &nbsp; &nbsp;- response.Binarywrite(byteArray)
 
  ;  Catch Ex As Exception
 &nbsp; &nbsp; &nbsp; -send 'error.jpg' file
&nbsp; &nbsp; End Try
&nbsp; &nbsp; &nbsp;
 
Grid
in the RowDataBound event, if the row is a datarow then initialize the column with the hyperlink control path point to the fetchimage.aspx?pk = " & e.item.DataItem("PK")
 
You can look up how to read the binary bits from a database if you google.

&gt; Date: Fri, 18 Apr 2008 02:28:24 -0700
> From: MKamoskiYahoo.com
> Subject: [aspnet-databases] RE: Error displaying images in gridview
&gt; To: aspnet-databasesaspadvice.com
>
> Why not store the image in the file system?
&gt;
>
> On Apr 18, 2008, at 3:21, "dipak mishra" <mishradipakgmail.com&gt; wrote:
>;
> Dear Allen,
>; I am storing Image itself in database not the path to it.
> How to display that using image field.
>; I am not able to do so.
> Plz Help
>
> On 4/18/08, Allen Moon <howlmoonclearwire.net> wrote:
>; Hey there
> In ASP 2.0 there is a ImageField in gridview that you need to use.
>
> -----Original Message-----
> From: dipak mishra [mailto:mishradipakgmail.com]
> Sent: Thursday, April 17, 2008 1:15 PM
> To: aspnet-databasesaspadvice.com
> Cc: aspnet-databasesaspadvice.com
> Subject: [aspnet-databases] Error displaying images in gridview
&gt;
> Hi All,
> I am facing a problem on which i would like to have suggestions.
> I have an ERP Application in ASP.net 2.0 with sql 2005 as back end. I am
> storing images in database then i am displaying it on a page and giving the
> URL of that page in grid view template field which has a image control.
&gt; Same thins i have been doing in application developed in asp 1.0 and sql 7.0
> the images are displayed correctly everywhere.
> But in this application in Grid view the same image have stopped being
> displayed. Although if i view them individually on other page they are
> displayed correctly.
> The client has genuine sql server.with service pack 2. Same things are
> working fine on my development machine and similar thing is running fine in
> asp 1.0 and sql 7.0.
> It was running fine on this clients system too. All of a sudden this is not
> displaying image in grid view.
> I have reinstalled sql2005 still same problem.
&gt; The images are saved in sql 2005 this i have checked also the images are
> displayed correctly individually which proves images are in fact saved
> actually.
> Any help will be graetly appreciated since i am stuck
> Regards
&gt; Dipak
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com
>
>
>
> ____________________________________________________________________________________
&gt; Be a better friend, newshound, and
> know-it-all with Yahoo! Mobile. Try it now. http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ
>
>
> Need SQL Advice? http://sqladvice.com
> Need RegEx Advice? http://regexadvice.com
> Need XML Advice? http://xmladvice.com



Going green? See the top 12 foods to eat organic. Need SQL Advice? http://sqladvice.com
Need RegEx Advice? http://regexadvice.com
Need XML Advice? http://xmladvice.com
[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )