Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Read an OLE field from MS Access (mdb)

Status
Not open for further replies.

redjoy

Programmer
Mar 23, 2004
6
US
I have a very large MS Access database and I am trying to extract an OLE field as part of my report (currently txt file but will eventually RTF or PDF format)

Code:
	use DBI;
	use User;
	use PDF::Create;
        use Win32::OLE;
#Open output txt file
open ( FILE_NAME_STD, ">C:\\database\\out.txt") || die "cannot open file: $!\n

#open connection to STD database
$dbhSTD = DBI->connect('dbi:ODBC:driver=microsoft access driver (*.mdb);dbq=c:\\database\\db1');
$dbhSTD->{'LongTruncOk'} = 0;
$dbhSTD->{'LongReadLen'} = 65535 ;
$dbhSTD->{'AutoCommit'} = 0;

#Get Appendix E Picture
#construct SQL statement
$sqlstatementAppendixEPicture = "SELECT `APPENDIX E`.Picture
                            FROM `c:\\database\\db1`.`APPENDIX E` `APPENDIX E`
                            WHERE (`APPENDIX E`.CSCI='Type1')";
                            
#prepare and execute SQL statement
$sthAppendixEPicture = $dbhSTD->prepare($sqlstatementAppendixEPicture);
$sthAppendixEPicture->execute ||
   die "Could not execute SQL statement, maybe invalid?\n\n$sthAppendixEPicture\n\n";

#there is only one record using the WHERE clause
@rowSTD=$sthAppendixEPicture->fetchrow_array;
print FILE_NAME_STD "$rowSTD[0]\n";
 
When stepping through and after executing the following line.
Code:
@rowSTD=$sthAppendixEPicture->fetchrow_array;
I get the following error message:
DBD::ODBC::st fetchrow_array failed: [Microsoft][ODBC Microsoft Access Driver]String data, right truncated on column number 1 (Picture) (SQL-01004)(DBD: st_fetch/SQLFetch (long truncated DBI attribute LongTruncOk not set and/or LongReadLen too small) err=-1) at K:\scripts\stdToPDF.pl line 465, <STDIN> line 1.

This object is either a Visio file or a Powerpoint file.

What I want to do is extract it and put it in a PDF file.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top