I want to fetch data from OLEDB SQL Server and display it in gridview, I am able to fetch data except for Image:
<asp:GridView ID="GridView1" runat="server" AllowPaging="True"
AutoGenerateColumns="False" DataSourceID="SqlDataSource1"
EnableModelValidation="True" Height="184px" Width="546px">
<Columns>
<asp:BoundField DataField="col_FirstName" HeaderText="col_FirstName"
SortExpression="col_FirstName" />
<asp:BoundField DataField="col_LastName" HeaderText="col_LastName"
SortExpression="col_LastName" />
<asp:BoundField DataField="col_age" HeaderText="col_age"
SortExpression="col_age" />
<asp:BoundField DataField="col_photo" HeaderText="col_photo"
SortExpression="col_photo" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT [col_FirstName], [col_LastName], [col_age], [col_photo] FROM [tbl_PersonInfo_Test]">
</asp:SqlDataSource>`
As you are using a binaryField in your dataBase you can create a simple imageHandler class. This class knows how to load an Image out of your data storage and writes it to the responseStream. See below for a very rough example.
imageHandler.aspx
ASPX
You can find several examples on the web. See Displaying Images in gridViews or ImagesFromDBinGridView or just ask Mr. Google.