Reputation: 172
I have table named assignWork having four varchar fields and one varbinary field respectively. However the problem is when i am trying to create a view of my table on GridView it shows all the fields except that image that I have stored. Is it because I need to perform some conversions or the gridView does not show images?
This is the code behind gridView which I have tried so far:
protected void Page_Load(object sender, EventArgs e)
{
SqlConnection con = new SqlConnection("data source= (local);database=project_cg;integrated security=SSPI");
SqlCommand cmd = new SqlCommand("Select * from assignWork", con);
con.Open();
SqlDataReader rdr = cmd.ExecuteReader();
GridView1.DataSource = rdr;
GridView1.DataBind();
con.Close();
}
Upvotes: 0
Views: 102
Reputation: 26
This will give you a good heads up.. Why don't you try this? http://www.brainbrushups.com/2013/06/how-to-save-image-in-binary-format-in.html
This involves two pages. One is you main grid page. Second is an explicit aspx page just to show up your image which will be rendered for each record in the grid for image column.
Upvotes: 1