Attachments
ImageByte = (byte[]) vcom.ExecuteScalar();
Unable to cast object of type 'System.String' to type 'System.Byte[]'.
byte[] ImageByte = null; MemoryStream MemStream = null; OleDbConnection cn = new OleDbConnection(); cn.ConnectionString = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:/ALL/Database7.accdb"; cn.Open(); OleDbCommand command = new OleDbCommand(); command.Connection = cn; string sql = "select Attachments from Contacts where ID = 1"; OleDbCommand vcom = new OleDbCommand(sql, cn); ImageByte = (byte[]) vcom.ExecuteScalar(); MemStream = new MemoryStream(ImageByte); pictureBox1.Image = Image.FromStream(MemStream); cn.Close();
ExecuteScalar()
byte[]
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)