public void loadimage() { ConnectionStringSettings conSetting = ConfigurationManager.ConnectionStrings["MyDBConnectionString"]; string connectionString = conSetting.ConnectionString; conn = new SqlConnection(connectionString); conn.Open(); try { if (conn.State == System.Data.ConnectionState.Open) { string sss = "SELECT ProductImage from ProductServices where ProductCode=@productCode"; SqlCommand cmd = new SqlCommand(sss, conn); cmd.Parameters.AddWithValue("@productCode", txtCode.Text); Byte[] getImg = (Byte[])cmd.ExecuteScalar(); MemoryStream stream = new MemoryStream(getImg); Image img = Image.FromStream(stream); pictureBoxProduct.Image = img; } } catch (Exception ex) { MessageBox.Show(ex.Message); } finally { conn.Close(); } }
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)