SPUG: MS Access and DBI
Richard Wood
wildwood_players at yahoo.com
Tue May 29 17:57:41 CDT 2001
I don't use DBI on Access but I use it heavily on
Oracle.
Here are examples of one of my deletes and updates:
THE DELETE
$dbh->do("DELETE temp_npanxx WHERE npanxx = $db_npanxx
AND npac_site = '$db_npacsite'")
|| warn "\nThe delete row from temp_npaxx failed:
$DBI::errstr\n";
THE UPDATE
$sth_update = $dbh->prepare("UPDATE NPAC_NPANXX
SET npac_site = ?,
effective_dt = to_date(?,'SYYYYMMDDHH24MISS'),
ocn = ?,
company = ?,
update_dt = to_date(?,'SYYYYMMDDHH24MISS'),
active_cd = ?
WHERE npanxx = ? AND npac_site = ?");
$sth_update->execute(
$npacsite,
$u_effdate,
$ocn,
$ucompany,
$u_update_dt,
$active_cd,
$npanxx,
$npacsite);
die "Unexpected Oracle error: $DBI::errstr\n"
if (!$DBI::errstr =~ /NPAC_NPANXX_PK/);
I hope this gives some insight.
Regards,
Rich Wood
--- David Bitseff <dbitsef at qwest.com> wrote:
>
>
> Sorry,
>
> What I meant was; Try removing the '*' character.
> I'm not familiar
> with Access, but I think SQL delete statements don't
> have an asterisk.
>
>
> Brose, Eric writes:
>
> > 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/
>
>
=====
Richard O. Wood
Wildwood IT Consultants, Inc.
wildwood_players at yahoo.com
425.941.9437
__________________________________________________
Do You Yahoo!?
Yahoo! Auctions - buy the things you want at great prices
http://auctions.yahoo.com/
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
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