Answer the question
In order to leave comments, you need to log in
How to insert an image into an OLE database field using C#?
Good day everyone!
There is an access database in mdb format, you need to insert a jpg image from an application developed in visual C# 2010.
In the database, pictures are stored in the field of the OLE object.
The fact is that if you add pictures directly through access, then the pictures will be stored in the OLE field as a Bitmap Image. These pictures are opened from access by double clicking the mouse.
There is the following code:
OdbcConnection Connection = new OdbcConnection();
...
sql = "INSERT INTO Фильм (Плакат) VALUES (" ' " + Image.FromFile(textBox8.Text) + " ' ");";
//в текстбоксе хранится путь до картинки
OdbcCommand Command = new OdbcCommand(sql, Connection);
Command.ExecuteNonQuery();
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question