开发者

Accessing Microsoft Access 2003 and 2007 BLOB fields from .Net

I need to be able to extract BLOBs from both Access 2003 and Access 2007. Access 2003 stores BLOBs as "OLE Objects", and Access 2007 gives you another option, "Attachment". The major difference is that multiple attachments can added to a single row, whereas there can be only one BLOB per "OLE Object" data type.

I have to be able to do this withou开发者_如何学JAVAt using interop as I cannot force the dependency of having Office installed. That leaves me with either DAO or ADO. So I have written the code to use both technologies to pull the BLOBs out of a test database with loads of different types of file types embedded.

The problem I have is that it seems Access wraps the embedded files in some type of meta data. The net result is that the file, once extracted, is no longer the same and can not be opened by the associated application because its "corrupted". Access stores things like the original file name and so forth in this meta data. I need to be able to strip that meta data off of the files to have the file in its original state.

Is there some dark voodoo magic which can do this? There is very little by way of documentation on this subject. Any help would be appreciated.

Thanks in advance.


This occours because OLE objects are stored like "images" on Access. This leads to performance issues, also problems like yours. To deal with these limitations, Microsoft introduced Attachment fields on Access 2007/2010, wich doesn't need OLE servers to run content. Attachments, wich should be more than one file per record, are automaticaly managed in backstage by MS-Access. Maybe you should use Attachments or change your database for SQL Server, MY-SQL, Firebird.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜