Hi,
I have an access database with one field of type OLE Object. I want to insert a picture and I have this code:
byte[] imageData = ReadFile(textBox15.Text);
com.Parameters.AddWithValue("@Slikadog", imageData);
byte[] ReadFile(string sPath)
{
byte[] data = null;
FileInfo fInfo = new FileInfo(sPath);
long numBytes = fInfo.Length;
FileStream fStream = new FileStream(sPath, FileMode.Open, FileAccess.Read);
BinaryReader br = new BinaryReader(fStream);
data = br.ReadBytes((int)numBytes);
return data;
}
void GetImagesFromDatabase()
{
try
{
OleDbDataAdapter ADAP = new OleDbDataAdapter("Select Slikadog from Dogovor", conn);
DataSet DS = new DataSet();
ADAP.Fill(DS, "Dogovor");
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString());
}
}
but when I run the application, in the database Ole Object field (the image field) I get only "Long binary data"
I don't know whether this is the right way to insert picture from a file. Please help me.
Thank you in advance.
Loading

Satyapriya NayakRank #47 · 31.5K reputationPosted Feb 1, 2012, 5:17 AM EST
Please refer the below links
http://support.microsoft.com/default.aspx?scid=kb;en-us;317016&Product=vcSnet
http://www.mikesdotnetting.com/Article/123/Storing-Files-and-Images-in-Access-with-ASP.NET
http://satishjdotnet.blogspot.in/2009/04/save-images-in-access-database-aspnet.html
Thanks
Pravin GhadgeRank #1,340 · 1.3K reputationPosted Feb 1, 2012, 5:24 AM EST
The problem may be image size is too large.
What type of image u r trying to insert?
U try to insert differnt type of images say .bmp ,.jpg
Then check whether all types of images giving u same error or r getting inserted in db.
VulpesRank #55 · 29.2K reputationPosted Feb 1, 2012, 5:54 AM EST
NelRank #2,060 · 702 reputationPosted Feb 1, 2012, 11:40 PM EST