string connStr2 = ConfigurationManager.ConnectionStrings["ImageMDFdb"].ConnectionString; string cmdStr2 = "SELECT * FROM [ImageTable];"; byte[] btImage = null; DataSet ds = new DataSet(); try { using (SqlConnection conn2 = new SqlConnection(connStr2)) { using (SqlCommand cmd2 = new SqlCommand(cmdStr2, conn2)) { conn2.Open(); using (SqlDataAdapter da = new SqlDataAdapter(cmd2)) { da.Fill(ds); btImage = (byte[])ds.Tables[0].Rows[0][3]; GridView1.DataSource = ds; GridView1.DataBind(); } conn2.Close(); cmd2.Dispose(); conn2.Dispose(); } } } catch (Exception ex) { Label2.Text = "Gridview: " + ex.ToString(); }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)