OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + bankaddress); OleDbCommand com = new OleDbCommand(); con.Open(); com.Connection = con; com.CommandType = CommandType.Text; com.CommandText = "SELECT [Attachment],[FileName] From Dan_Attach WHERE ID=94"; OleDbDataReader Reader2 = com.ExecuteReader(); while (Reader2.Read()) { MessageBox.Show(Reader2.GetValue(1).ToString()); byte[] pic = new byte[2048]; Reader2.GetBytes(0,0,pic,0,2048); MemoryStream MS = new MemoryStream(pic); Image returnImage = Image.FromStream(MS); pictureBox1.Image = returnImage; con.Close(); } public Image byteArrayToImage(byte[] byteArrayIn) { MemoryStream ms = new MemoryStream(byteArrayIn); Image returnImage = Image.FromStream(ms); return returnImage; }
System.Data.DataTableReader.GetBytes
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)