in reply to print hash into scalar

If you want data from the hash to go straight into Access, you could try something like this ;
use strict; use warnings; use Win32::ODBC; # see Programming the Perl DBI page 167 # connect to data source my $db = new Win32::ODBC("DSN=mydsn;") or die Win32::ODBC::Error(); # some data to insert my %addrRow = ( 'name' => 'Billy', 'email' => 'billy@email.com', 'city +' => 'NY', 'country' => 'USA' ); my $name = $addrRow{'name'}; my $email = $addrRow{'email'}; my $city = $addrRow{'city'}; my $country = $addrRow{'country'}; # prepare and execute if ( $db->Sql( "INSERT INTO address (name,email,city,country) VALUES (\'$name\',\'$email\',\'$city\',\'$country\') " ) ){ print "SQL Error; ". $db->Error()."\n"; } # exit $db->Close();

poj

Replies are listed 'Best First'.
Re: Re: print hash into scalar
by Ryszard (Priest) on Dec 23, 2002 at 10:46 UTC
    you could try something like this

    <coff>placeholders</coff>

      Normally I would, but does Win32::ODBC support placeholders ? The DBI book I have said it didn't but things may have changed.
      poj

        It doesn't matter. If the underlieing database doesn't support placeholders, DBI catches the SQL and won't send it to the actual database until the placeholders are filled in.