Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW

Re: How can I import text to Access

by soonix (Monsignor)
on Jun 01, 2015 at 11:18 UTC ( #1128550=note: print w/replies, xml ) Need Help??

in reply to How can I import text to Access

My "old" VBScripts (not (yet) rewritten into Perl) are using the newer ADO instead of the older DAO.

Perhaps some of the responses in the threads How can I connect my perl script to an Access 2010 (.accdb) file? and/or SQL Server Compact Edition (SQL CE) on Windows 7 (64bit) are helpful?

I found these via Super Search for "ADODB", but since the topic isn't very "hot", I had to press "Next" on the first (empty) result page.

Replies are listed 'Best First'.
Re^2: How can I import text to Access
by Broggy69 (Novice) on Jan 03, 2018 at 16:17 UTC

    While this is an old post I did manage to get this figured out. Here is my code.

    my $filename = 'C:/GBowl/strawberry32/Scripts/ccname.txt'; my $db_file = 'C:/GBowl/strawberry32/Scripts/Hello.accdb'; my $dbh = DBI->connect( 'dbi:ADO:Provider=Microsoft.ACE.OLEDB.12.0;Data Source='.$db_file, ) or die $DBI::errstr; print $filelog "Connected to ms-access database\n"; #prepare and execute SQL statement $Export = $dbh->prepare( 'SELECT Company_Code, Name INTO [Text;HDR=No;DATABASE=C:\GBowl\str +awberry32\Scripts].[Plants.txt] FROM Plants ORDER BY Company_Code'); $Export->execute || die "Could not execute SQL statement ... maybe invalid?";

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://1128550]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others about the Monastery: (4)
As of 2018-06-24 00:06 GMT
Find Nodes?
    Voting Booth?
    Should cpanminus be part of the standard Perl release?

    Results (126 votes). Check out past polls.