Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
In their infintite wisdom, Microsoft decided to make Memo fields like Blobs but with some additional bits and bobs on top.

What this means is that you have to connect to the database in a totally different way. This is not a fault of the DBI or Perl as it catches you out in ASP code just as easily. To solve this, as far as I can see, you should use Win32::OLE and build recordsets to access your data. If not, then you'll have to save your data to disk and reference the filename in the database.

If you want the memo fields, the code (in VBScript) is as follows:
Set RS = Server.CreateObject("ADODB.RecordSet") RS.CursorLocation = adUseClient RS.Open table_name_or_sql_query, your_connection_object, adOpenKeyset

I took that from here. Now looking at the constants stuff, we need to define adUseClient and keyset which we can set as :
use constant adUseClient => 3; use constant adOpenKeyset => 1;


So all we need to do now is create the recordset and the connection object. Full code
use Win32::OLE; use strict; use constant adUseClient => 3; use constant adOpenKeySet => 1; my $db_connection = new Win32::OLE('ADODB.Connection'); my $rs = new Win32::OLE("ADODB.Recordset"); my $db_datasource = 'Driver={Microsoft Access Driver (*.mdb)}; +'; # My database is called test.mdb and is in the same dir. $db_datasource .= 'DBQ=test.mdb'; # Connect to the database and tie the recordset object to # the database. $db_connection->Open($db_datasource); # Set the connection doohickey $rs->CursorLocation(adUseClient); $rs->Open('test', $db_connection, adOpenKeySet);

I did a quick test on my win2k machine with an access2000 database and it ran without error (note that this is a DSN less connection). I hope that gives you a starting point :)
Cheers - Simon

In reply to Re: Cannot insert into MS Access Memo field with DBI by simon.proctor
in thread Cannot insert into MS Access Memo field with DBI by drewbert2000

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • Outside of code tags, you may need to use entities for some characters:
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?
    Username:
    Password:

    What's my password?
    Create A New User
    Chatterbox?
    and the web crawler heard nothing...

    How do I use this? | Other CB clients
    Other Users?
    Others surveying the Monastery: (3)
    As of 2014-09-18 23:35 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      How do you remember the number of days in each month?











      Results (126 votes), past polls