Problem in displaying Image in DataView..

  • Thread starter Thread starter Winista
  • Start date Start date
W

Winista

Isn't Picture column in NW database "Binary" type field? You first need to
get the binary blob from DB, store it as image file on disk and then specify
the URL. Or you need to stream the binary data through a control as image
stream into the response.
 
Asp.Net 2

I am trying to display Image from Northwind Database.

I ran a queary "SELECT CategoryID, CategoryName, Description, Picture FROM
Categories" but the Dataview displayes all the fields except Picture.

so i add a Imagefield to display images..but now i get cross icon..

below is the code. correct me where i am wrong....

<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
DataKeyNames="CategoryID"
DataMember="DefaultView" DataSourceID="SqlDataSource1">
<Columns>
<asp:BoundField DataField="CategoryID"
HeaderText="CategoryID" InsertVisible="False"
ReadOnly="True" SortExpression="CategoryID" />
<asp:BoundField DataField="CategoryName"
HeaderText="CategoryName" SortExpression="CategoryName" />
<asp:BoundField DataField="Description"
HeaderText="Description" SortExpression="Description" />
<asp:ImageField DataAlternateTextField="Picture"
DataImageUrlField="Picture" DataImageUrlFormatString="~\Images\{0}.jpg"
HeaderImageUrl="Picture" HeaderText="Picture"
ReadOnly="True">
</asp:ImageField>
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:NorthwindConnectionString %>"
SelectCommand="SELECT CategoryID, CategoryName, Description,
Picture FROM Categories">
</asp:SqlDataSource>
 
i appericate your quick respond.

i am sorrry i am very basic in asp.net. i wonder how i would convert the
blob stuff..

is there any other way to display an image frm DB ?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top