Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: print hash into scalar

by poj (Abbot)
on Dec 23, 2002 at 10:24 UTC ( [id://221837]=note: print w/replies, xml ) Need Help??


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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://221837]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others taking refuge in the Monastery: (4)
As of 2024-04-24 13:07 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found