I have an Access .mdb database and I want to insert an image from an application developed in visual C# 2010. Pictures are stored in the database in the field of OLE-object.
After adding images directly in Access they are stored in the format of an Bitmap Image. These pictures can be opened in Access with a double-click.
I have the following code:
OdbcConnection Connection = new OdbcConnection(); ... sql = "INSERT INTO film (poster) VALUES (" ' " + Image.FromFile(textBox8.Text) + " ' ");"; //texbox are stored the picture name OdbcCommand Command = new OdbcCommand(sql, Connection); Command.ExecuteNonQuery();
The code works well, but Access stores the picture as binary data and it cannot be opened again in Access. Please tell me how to insert the image as a Bitmap Image. Thanks.