Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Comment on

( #3333=superdoc: print w/ replies, xml ) Need Help??
#!perl/bin/perl use win32; use Win32::ODBC; use CGI qw(:standard); $data="ibd_lib.txt"; $test="test.txt"; my (@statement); # array of sql statements my $db=new Win32::ODBC("DSN=bisx;UID=;PWD="); ### report connection status if (!$db) { print "\nunable to connect to database!\n"; die(); } ### Open File for Reading open(FR, "< $data") || die "cannot open $data for reading: $!"; ###open(FW, "> $test") || die "cannot create $test: $!"; while(<FR>) { ### Write to Database push @statement, "INSERT INTO UserTestingE (ID) VALUES (\t$_\n)"; ### print FW $_; } ### Close the file close(FR) || die "cant close $ibd_lib: $!"; ###close(FW) || die "cant close $test: $!" ### Close the database $db->Close();
I don't have the DBI module i get this error: Can't locate DBI.pm in @INC (@INC contains:

The only way that i know how to write to an access databse is using the Win32::ODBC module just like above. I just don't know if i'm doing it right or what is going on. Please take a look at it and tell me what you think. the file is a comma delimited file that has about 10,000 lines and i need to take each line and insert it one after another in an access database. Thanks, Elvin


In reply to RE: Re: Reading from a file and writing the content into a database by Anonymous Monk
in thread Reading from a file and writing the content into a database by Kiko

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 pondering the Monastery: (13)
    As of 2014-07-10 11:38 GMT
    Sections?
    Information?
    Find Nodes?
    Leftovers?
      Voting Booth?

      When choosing user names for websites, I prefer to use:








      Results (207 votes), past polls