SPUG: MS Access and DBI
Brose, Eric
eric.brose at attws.com
Tue May 29 17:52:40 CDT 2001
That's it!
Weird...so I guess I'll have to enter parameters for UPDATE and DELETE
queries into the execute function. I wonder why I could pass all of my
qualifiers through just fine using select and insert statments and I have to
change it in cases like these.
Thanks,
Eric
-----Original Message-----
From: Craig Sutton [mailto:craig at n2h2.com]
Sent: Tuesday, May 29, 2001 3:37 PM
To: Brose, Eric
Subject: RE: SPUG: MS Access and DBI
oh... I think I had that mixed up. It should be:
my $var = "Scooby";
my $sql = "DELETE * from Player where Player.playerName = ?";
my $sth = $dbh->prepare($sql);
$sth->execute($var);
$var was in the wrong place. :)
Craig
---------------------------------------------------------
Craig Sutton
ICE Programming type | Plagiarism saves time.
N2H2 Inc.
Phone: 1.206.336.2929
E-Mail: craig at n2h2.com
900 4th Ave Suite #3400, Seattle, WA 98164
On Tue, 29 May 2001, Brose, Eric wrote:
> C:\My Documents\My Projects\nfl2K2>perl update.pl
> DBI::st=HASH(0x10257a4)->_prepare(...): attribute parameter 'Scooby' is
not
> a hash ref at C:/Perl/site/lib/DBD/ODBC.pm line 99.
>
>
> Why is it trying to interpret this as a hash ref?
> -----Original Message-----
> From: Craig Sutton [mailto:craig at n2h2.com]
> Sent: Tuesday, May 29, 2001 2:54 PM
> To: Brose, Eric
> Subject: Re: SPUG: MS Access and DBI
>
>
> Try something like:
>
> my $var = "Scooby";
> my $sql = "DELETE * from Player where Player.playerName = ?";
> my $sth = $dbh->prepare($sql, $var);
> $sth->execute();
>
> See if that does the job.
>
>
> Craig
>
> ---------------------------------------------------------
> Craig Sutton
> ICE Programming type | Plagiarism saves time.
> N2H2 Inc.
> Phone: 1.206.336.2929
> E-Mail: craig at n2h2.com
> 900 4th Ave Suite #3400, Seattle, WA 98164
>
>
> On Tue, 29 May 2001, Brose, Eric wrote:
>
> > Hello,
> >
> > I've written a few small CGI apps in which i've used an MS Access dB as
> the
> > backend. Until now, I've only had to use select and insert statements
and
> > everything's been hunky dory. Whenever I try to run a very simple
UPDATE
> or
> > DELETE stmt like this
> >
> > my $sqlstatement="DELETE * from Player WHERE
> > Player.playerName=\"Scooby\";";
> > print "$sqlstatement";
> > my $sth = $dbh->prepare($sqlstatement);
> > unless ($sth->execute) {
> > die "Could not execute SQL statement ... maybe invalid?";
> > }
> >
> > I get an error reading:
> >
> > DBD::ODBC::st execute failed: [Microsoft][ODBC Microsoft Access Driver]
> Too
> > few parameters. Expected 1
> > . (SQL-07001)(DBD: st_execute/SQLExecute err=-1) at update.pl line 26.
> >
> > I don't want to change the design of my dB to get around this, but I
> haven't
> > been able to get this to work for a few days now. Does anyone have
> > experience with this?
> >
> > Thanks,
> > EB
> >
> >
> > - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
-
> > POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
> > Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
> > Replace ACTION by subscribe or unsubscribe, EMAIL by your
Email-address
> > For daily traffic, use spug-list for LIST ; for weekly,
spug-list-digest
> > Seattle Perl Users Group (SPUG) Home Page:
http://www.halcyon.com/spug/
> >
> >
> >
>
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
POST TO: spug-list at pm.org PROBLEMS: owner-spug-list at pm.org
Subscriptions; Email to majordomo at pm.org: ACTION LIST EMAIL
Replace ACTION by subscribe or unsubscribe, EMAIL by your Email-address
For daily traffic, use spug-list for LIST ; for weekly, spug-list-digest
Seattle Perl Users Group (SPUG) Home Page: http://www.halcyon.com/spug/
More information about the spug-list
mailing list