Note that there are some explanatory texts on larger screens.

plurals
  1. POtrouble creating table with a field of type MEMO in Access db using perl/dbi/ODBC
    text
    copied!<p>perl 5.8.9</p> <p>Hello folks,</p> <p>I am successful in using DBI/DBD/ODBC to create a new table in an existing Access 2003 (.mdb) database with the following string: $q = "CREATE TABLE memoTestA (name TEXT, addr TEXT)"; # works</p> <p>but I can't figure out how to add a field of type MEMO ie $q = "CREATE TABLE memoTestB (name TEXT, addr TEXT, desc MEMO)"; # throws syntax error</p> <p>There must be a way - what is the trick?</p> <p></p> <p>switching form using DBD::ODBC to Win32::OLE gets me past the "bad syntax" error thrown by the ->Execute stmt, but I do not see the table actually created within the Access database. Hm.</p> <pre><code>#------------------------------- sub setUpDatasourceLocalAccessC($) { my $debug = 0; my ( $dbFile) = @_; #Choose appropriate version of Jet for your system my $Jet = Win32::OLE-&gt;CreateObject('DAO.DBEngine.36') or die "Can't create Jet database engine."; my $dbh = $Jet-&gt;OpenDatabase( $dbFile); return $dbh; } #------------------------------- sub createMemoTablePrepareC($) { my ($dbh_vdms) = @_; print "entering createMemoTablePrepareC\n" if $debug; my $errorHit = 0; my @table_arry = (); my @goodtable_arry = (); my $q = undef; if( !defined( $dbh_vdms)) { _pushErrorMsg("db connection failed - ".$DBI::errstr); $errorHit = 1; } else { $q = "CREATE TABLE memoTestC (name TEXT, addr TEXT)"; # works $q = "CREATE TABLE memoTestC (name TEXT, addr TEXT, desc MEMO)"; #seems to work, no errmsg but dont see table appear in database $dbh_vdms-&gt;Execute( $q); if( my $errorMsg = $dbh_vdms-&gt;errstr ) { _pushErrorMsg("create statement failed - ".$errorMsg); $errorHit = 1; } $dbh_vdms-&gt;close(); $dbh_vdms-&gt;disconnect(); } print "exiting createMemoTablePrepareC with errorHit=".$errorHit."\n" if $debug; return $errorHit; } </code></pre> <p>TIA,</p> <p>Still-learning Steve</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload