0

Hello all Experts,

I have following Code to get Image from dataBase and Show it in the Gridview Control on my web page but I am succeded to get data but when I bound the DataSet with GridView it doesnot show me Image.

You can View error on Attached Image.


Can any one Solve my problem.

Thanks in Advance.

Public Cmd As New SqlClient.SqlCommand
  Public SQLCon As New SqlClient.SqlConnection(Con)
  Public ds As New DataSet
  Public myAdapter As New SqlDataAdapter
  Public MyActiveFormName As String
  Public Qry As String
  Public EmptyTable As Boolean



Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
    Sql_Procedures.Fill_DataSetWithOutArg("Sel_MovMaster", "Tbl_SelMovMaster4MainPage")

   dg_Main4Master.DataSource = Sql_Procedures.ds.Tables("Tbl_SelMovMaster4MainPage")
    dg_Main4Master.DataBind()

End Sub


  Public Sub Fill_DataSetWithOutArg(ByVal SPName As String, ByVal TableName As String)
    Try
      myAdapter = New SqlDataAdapter(SPName, SQLCon)
      myAdapter.Fill(ds, TableName)
      ds.Tables(TableName).Clear()
      myAdapter.Fill(ds, TableName)
      If ds.Tables(TableName).Rows.Count = 0 Then
        EmptyTable = True
      Else
        EmptyTable = False
      End If
    Catch ex As Exception
      MsgBox(ex.Message)
    End Try
  End Sub
Attachments GridView.JPG 7.1 KB
5
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by abhi1625
0

I don't recommend trying to store images in a database, try storing the path to the image in the database then load the image from the stored path.

0

You can store that image path and than you can call that path into another gridview, and image will be display after calling that path:Image1.ImageUrl = GridView1.SelectedRow.Cells[13].Text;

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.