PDA

View Full Version : Solved: ADO and Access 2007 attachment data type



stanl
08-30-2007, 07:38 AM
Having read/explored the attachment data type in Access 2007, I see that Microsoft uses DAO [talk about back to the future:banghead: ] but the methods LoadFromFile and SaveToFile seem similar to an ADODB.Stream -

I manually created a simple table [with an attachment data type named 'Info'] and attached a jpeg to the attachment, then used an ADO script to persist the recordset to xml, which looks like


<xml xmlns:s='uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882'
xmlns:dt='uuid:C2F41010-65B3-11d1-A29F-00AA00C14882'
xmlns:rs='urn:schemas-microsoft-com:rowset'
xmlns:z='#RowsetSchema'>
<s:Schema id='RowsetSchema'>
<s:ElementType name='row' content='eltOnly' rs:updatable='true'>
<s:AttributeType name='ClientId' rs:number='1' rs:maydefer='true' rs:write='true' rs:basetable='Clients' rs:basecolumn='ClientId'>
<s:datatype dt:type='string' dt:maxLength='5'/>
</s:AttributeType>
<s:AttributeType name='GroupId' rs:number='2' rs:maydefer='true' rs:write='true' rs:basetable='Clients' rs:basecolumn='GroupId'>
<s:datatype dt:type='string' dt:maxLength='5'/>
</s:AttributeType>
<s:AttributeType name='Info' rs:number='4' rs:nullable='true' rs:maydefer='true' rs:write='true' rs:basetable='Clients'
rs:basecolumn='Info'>
<s:datatype dt:type='string' dt:maxLength='536870910' rs:long='true'/>
</s:AttributeType>
<s:AttributeType name='RegionId' rs:number='3' rs:maydefer='true' rs:write='true' rs:basetable='Clients' rs:basecolumn='RegionId'>
<s:datatype dt:type='string' dt:maxLength='5'/>
</s:AttributeType>
<s:extends type='rs:rowbase'/>
</s:ElementType>
</s:Schema>
<rs:data>
<z:row ClientId='1001' GroupId='North' Info='??' RegionId='North'/>
</rs:data>
</xml>


So, according to ADO, the Info field [which is an attachment type] is persisted as a large memo, and is referenced as a pointer rather than a field value [which makes sense].

My question(s) are:

Can ADO be used to Create an attachment data type [using the ACE.12 Provider] with perhaps some special property like in autoincrement fields which are created as adInteger initially?

Can ADO be used to Insert/remove specific attachments?

:dunno Stan

stanl
08-31-2007, 07:11 AM
NeverMind:rofl: The freeware Access 2007 Runtime supports their new DAO.DbEngine.120 ... so one can store and retrieve individual attachments w/out Office 2007 installed. Stan