Hi.

----- Original Message -----
From: "Krung Saengpole" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Thursday, June 14, 2001 6:07 AM
Subject: SQL statement.


> Hi all,
>
> I have one problem that should not be. I use Access97 on NT server with
IIS5. I couldn't use placeholder in SQL statement as below:
>
> use DBI;
> $dbh = DBI->connect("dbi:ODBC:myDSN",'','');
> $sql = "Select * From myTable Where ID_Code = ?";
> $sth = $dbh->prepare($sql);
> ...
> $sth->execute($ID_code);  #ID_code contains ID_Code value
> $rc = $sth->fetchrow_hashref;
> print $rc->{'FIELD_NAME'}; # no result
First of all, I recommend you to 'use strict' and set AutoCommit attribute
explicitly.
And check each call or set RaiseError attribute.

I found no problem like below:
[Script]
use strict;
use DBI;
my $dbh = DBI->connect("dbi:ODBC:myDSN",'','',
  {AutoCommit => 1, RaiseError=>1})
  or die "$DBI::errstr\n";
my $sql = "Select * From myTable Where ID_Code = ?";
my $sth = $dbh->prepare($sql);
my $ID_code='1000';
$sth->execute($ID_code);  #ID_code contains ID_Code value
my $rc = $sth->fetchrow_hashref;
print $rc->{'FIELD_NAME'}; # no result

==============================================
Kawai, Takanori(Hippo2000)
   Mail: [EMAIL PROTECTED] [EMAIL PROTECTED]
   http://member.nifty.ne.jp/hippo2000
==============================================

Reply via email to