M
MarcelV
Hi Experts,
I am trying to add documents (xl, doc, pdf, image) into our database.
In this case it will be an access database because of the local
caching. But that is not the issue.
I managed from a windows form with drag/drop or fileselecter to select
a file. I store the path in memory. When saving the information on the
screen with the path to the file I transfer the file to a byte array.
<CODE>
public static byte[] GetPhoto(string filePath)
{
FileStream fs = new FileStream(filePath, FileMode.Open,
FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] photo = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();
return photo;
}
</CODE>
So far so good. Now comes the problem. I store the data with our own
created sql string. So not open a dataset and fill in the properties.
Just an easy simple "INSERT INTO....etc VALUES....
My problem is how to convert the photo byte array to a format which
will be accepted within the insert statement.
Just adding phone whil result in system.byte[] as string in the field
Just adding phone.Length will result in a few numbers.
The field in which it has to be inserted is a ole-object .
Thanks, for all help.....
I am trying to add documents (xl, doc, pdf, image) into our database.
In this case it will be an access database because of the local
caching. But that is not the issue.
I managed from a windows form with drag/drop or fileselecter to select
a file. I store the path in memory. When saving the information on the
screen with the path to the file I transfer the file to a byte array.
<CODE>
public static byte[] GetPhoto(string filePath)
{
FileStream fs = new FileStream(filePath, FileMode.Open,
FileAccess.Read);
BinaryReader br = new BinaryReader(fs);
byte[] photo = br.ReadBytes((int)fs.Length);
br.Close();
fs.Close();
return photo;
}
</CODE>
So far so good. Now comes the problem. I store the data with our own
created sql string. So not open a dataset and fill in the properties.
Just an easy simple "INSERT INTO....etc VALUES....
My problem is how to convert the photo byte array to a format which
will be accepted within the insert statement.
Just adding phone whil result in system.byte[] as string in the field
Just adding phone.Length will result in a few numbers.
The field in which it has to be inserted is a ole-object .
Thanks, for all help.....