> -----Original Message-----
> From: Sterin, Ilya [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 10, 2001 2:26 PM
> To: Neil Lunn; 'Trevor Webster'; [EMAIL PROTECTED]
> Subject: RE: Problem with DBI and Access newbie
> 
> 
> >>    $SQL = qq|INSERT INTO Respondent (england, relativity,
> >> lotr) VALUES =
> >> ( '$england', '$relativity', '$lotr')|;
> 
> >And theres your problem. '$england' does not interpolate. You want
> >"$england" and so forth.
> 
> $england would interpolate, since it's enclosed in double 
> quotes qq | " ...

Your right, my bad. Think I need glasses.

Something isn't normal here. Best to run a trace and see what is actually
happening.

> 
> $england = "test";
> 
> print qq/this is just a '$england'/;
> 
> would print
> 
> this is just a 'test'
> 
> 
> Ilya Sterin
> 
> 
> 
> -----Original Message-----
> From: Neil Lunn [mailto:[EMAIL PROTECTED]]
> Sent: Thursday, May 10, 2001 12:11 AM
> To: 'Trevor Webster'; [EMAIL PROTECTED]
> Subject: RE: Problem with DBI and Access newbie
> 
> 
> Missed this before. My eyes hurt! Answer Below.
> 
> > -----Original Message-----
> > From: Trevor Webster [mailto:[EMAIL PROTECTED]]
> > Sent: Wednesday, May 09, 2001 5:03 PM
> > To: [EMAIL PROTECTED]
> > Subject: Problem with DBI and Access newbie
> >
> >
> > Hello
> >
> > I am running a Perl script that is supposed to added a record
> > to an MS Access database using the DBI module.
> >
> > I am testing the script using MS PWS on a Windows 2000 os
> > with Activestate Perl 626.  Input into the script comes from
> > parsed form informtion, which is working successfully.
> >
> > When I run the script it appears to complete successfully.
> > That is it doesn't return any script syntax or DBI error
> > messages.  But when I check the database the record has not
> > been added.
> >
> > The database contains a single table with 4 columns:
> >     Respondent
> >         RespId        Autonumber
> >         england      Text
> >         relativity     Text
> >         lotr               Text
> >
> > Below is a copy of the script:
> >
> >  sub UpdateDatabase(){
> >
> >   use DBI;
> >
> >   $DSN = Survey Results
> >
> >   $myDb = DBI->connect('dbi:ODBC:Survey Results');
> >
> >   #Error trapping for invalid connection
> >   if (! $myDb){
> >      print "Failed to Connect $DSN\n";
> >      #end program as processing aborted
> >      die;
> >   }
> >
> >   #Setup Variables for loading table data
> >   $england = $PostInputs{ 'england'};
> >   $relativity = $PostInputs{ 'relativity'};
> >   $lotr = $PostInputs{ 'lotr'};
> >
> >    $SQL = qq|INSERT INTO Respondent (england, relativity,
> > lotr) VALUES =
> > ( '$england', '$relativity', '$lotr')|;
> 
> And theres your problem. '$england' does not interpolate. You want
> "$england" and so forth.
> Or even better:
> ###
> 
> $SQL = qq|INSERT INTO Respondent (england, relativity, lotr)
>     VALUES = (?,?,?)|;
> 
> $sth = $dbh->prepare($SQLQ);
> 
> eval {
>     while (...) { # loop through each whatever
>         $sth->execute($PostInputs{'england'},
>                       $PostInputs('relativity'},
>                       $PostInPuts{'lotr'}
>         };
>     };
>     $dbh->commit;
> };
> 
> if ($@) {
>     warn "Transaction aborted because $@";
>     $dbh->rollback;
> }
> 
> ####
> 
> Not that Acess supports transactions, but it's good practice 
> that you may as
> well start learning. Besides I couldn't resist. --grin!
> 
> Neil
> 
> ______________________________________________________________
> ____________
> Please Note :
> Only  the intended recipient is authorised to access or use 
> this e-mail.  If
> you are not the intended recipient,
> please delete this e-mail and notify the sender immediately.  
>  The contents
> of this e-mail are the writer's
> opinion and are not necessarily endorsed by the Gunz Companies unless
> expressly stated.
> 
> We use virus scanning software but exclude all liability for 
> viruses or
> similar in any attachment.
> 

__________________________________________________________________________
Please Note :
Only  the intended recipient is authorised to access or use this e-mail.  If
you are not the intended recipient,
please delete this e-mail and notify the sender immediately.   The contents
of this e-mail are the writer's 
opinion and are not necessarily endorsed by the Gunz Companies unless
expressly stated.

We use virus scanning software but exclude all liability for viruses or
similar in any attachment.


Reply via email to