Extracting OLE Object from MS Access
-
Hello, I'm using MS Access as database back-end for my C# application and I have an OLE Object field in my MS Access Database and I want to extract the content (say JPG image) to the users' desktop. I'm using OleDB and C#.NET 2.0. How can I do that? Thanks.
-
Hello, I'm using MS Access as database back-end for my C# application and I have an OLE Object field in my MS Access Database and I want to extract the content (say JPG image) to the users' desktop. I'm using OleDB and C#.NET 2.0. How can I do that? Thanks.
Hello O'm not sure if this would work or not, but read it as binary in a stream, and build an
image
object from that stream.Regards:rose:
-
Hello O'm not sure if this would work or not, but read it as binary in a stream, and build an
image
object from that stream.Regards:rose:
Thanks Nader it almost worked but I'm no getting a text file extracted well... the first line is: $ ےےےےPackage Package Package ²{ Sa.txt C:\DOCUME~1\Owner.Joe\Desktop\SA.txt $ C:\DOCUME~1\Owner.Joe\Desktop\SA.txt S{ ... Then the content of my file begins! The same for the last line: METAFILEPICT " »ْےےî "E s 2 ' ûُے گ Tahoma è vـٍ ¸¤َwء¤َw 0ُw‘"f - ےےے . ! Sa.txt! û ¼ ²"System ‘"f & ٹ ےےےےhَ - L What's worng? Thanks.
-
Thanks Nader it almost worked but I'm no getting a text file extracted well... the first line is: $ ےےےےPackage Package Package ²{ Sa.txt C:\DOCUME~1\Owner.Joe\Desktop\SA.txt $ C:\DOCUME~1\Owner.Joe\Desktop\SA.txt S{ ... Then the content of my file begins! The same for the last line: METAFILEPICT " »ْےےî "E s 2 ' ûُے گ Tahoma è vـٍ ¸¤َwء¤َw 0ُw‘"f - ےےے . ! Sa.txt! û ¼ ²"System ‘"f & ٹ ےےےےhَ - L What's worng? Thanks.
Textfile?? You didn't mention text? I thought you said that you are reading an image from the database, so you should read it as binary stream then on the fly call
Image.FromStream()
method. Why did you create a text file for the image? What you got is binary, and it won't be displayed properly by any text editor -eg. notepad-. If I'm getting you wrong or missing something, please clarify.Regards:rose:
-
Textfile?? You didn't mention text? I thought you said that you are reading an image from the database, so you should read it as binary stream then on the fly call
Image.FromStream()
method. Why did you create a text file for the image? What you got is binary, and it won't be displayed properly by any text editor -eg. notepad-. If I'm getting you wrong or missing something, please clarify.Regards:rose:
I thought it's the same thing so I said image just to make it simple :-O Ok so now I have an access db and I'm inserting an html document into an OLE field by right clicking and choosing insert object... How can I - by code - extract the exact html file and save it to the user desktop?
-
I thought it's the same thing so I said image just to make it simple :-O Ok so now I have an access db and I'm inserting an html document into an OLE field by right clicking and choosing insert object... How can I - by code - extract the exact html file and save it to the user desktop?
Well, please don't be offended, I was just wondering. To some extent yes, it could be almost the same. For the Html document you are storing -though I'd prefer to store it in the Db as text. This would be much easier-, the Html text itself won't be changed, but you wil find some binary OLE Metadata at the begining of the doument. You just got to ignore it in your Stream, and begin reading from the first Html tag -eg. <html>, or <body>, etc..-. That should do it, but then you have to treat it like text and not binary like storing it in a string and saving it to html file. Also the images of the html page won't be saved in the Db, and when you extract the file and save it to "something.html" you will only get the html and no pictures -except of course if they are online pictures, and you were connected-. I hope I was close enough this time. -- modified at 22:29 Sunday 15th October, 2006 Oh! I almost forgot. About the metadata at the end, just ignore whatever is after the </html> tag. BTW: How do you extract the Oleobject from you Db in C# code?
Regards:rose: