I've tried, but something still is not working.
Here is the code:
#! perl -w use DBI; use DBD::ODBC; # open connection to Access database $dbh = DBI->connect('dbi:ODBC:fred3'); my @lines = <DATA>; my $line; foreach $line ( @lines ) { my $sqlstatement = q{ SELECT Table1.Name, Table1.Address, Table1.City +, Table1.State, Table1.ZIP, Table1.Phone FROM Table1 WHERE Table1.Bus +Type = ?}; my $sth = $dbh->prepare($sqlstatement); foreach my $line (<DATA>) { chomp $line; $sth->execute( $line ); my $newdir= 'c:\redone'; my $extension= ".txt"; my $target = "$newdir/$line"; open( FINAL, ">$target" ) or die "Can't open $target:$!"; #output database results while (@row=$sth->fetchrow_array) { print FINAL "$row[0]\n$row[1]\n$row[2] $row[3] $row[4]<br>\n$row[5]\n\ +n"} close FINAL; } # end of fetchrow_array } # end of loop for each of data below __DATA__ ARCHITECTS INVESTIGATORS

In reply to Re^2: Quoting in DBI sql query for on the fly query by ParisR
in thread Quoting in DBI sql query for on the fly query by ParisR

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!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • 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, details, 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, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            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.