DBI::ADO is not a module.  The module is DBD::ADO.  But you don't need
to load it -- DBI will load it for you.

  use DBI;
  # DBI automatically loads ADO
  my $dbh = DBI->connect('dbi:ADO:...',...);

-----Original Message-----
From: Patrix Diradja [mailto:[EMAIL PROTECTED] 
Sent: Thursday, February 08, 2007 10:54 AM
To: dbi-users@perl.org
Subject: Balasan: RE: Balasan: RE: Balasan: RE: can't execute "use
$database"

Dear Garrett.... it still doesn't work.
   
  Here is the error message:
  Can't locate DBI/ADO.pm in @INC (@INC contains: C:\Program
Files\ActiveState Perl Dev Kit 6.0\lib\ C:/Perl/site/lib C:/Perl/lib .)
at cldump.pl line 8.
BEGIN failed--compilation aborted at cldump.pl line 8.
   
  Please tell me furthermore.
   
  here is my code:
  #####
  use strict;
use DBI::ADO;
use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';
use warnings;
  my $uname="sa";
my $pword="penguin";
my $host="127.0.0.1";
my @bd4l=("FinanCore");
  #if (@ARGV){
#my @[EMAIL PROTECTED];
#}else{
#my @bd4l=("AprovaApp1");
#}
  print "I am dumping... @bd4l\n";
foreach my $elemenbd4l(@bd4l){
my $dsn = "Provider=SQLNCLI;"
   . "Server=$host;"
   . "Database=$elemenbd4l;";
  my $dbh1 = DBI->connect("dbi:ADO:$dsn", $uname, $pword) or die
$DBI::errstr;

  ####

"Garrett, Philip (MAN-Corporate)" <[EMAIL PROTECTED]> wrote:
  Patrix Diradja wrote:
> Yeah, that's the problem Garrett.
> 
> I usually use that way to connect to ms msql.
> 
> But now, I want that my perl code can work with several databases.
> So I need somewhat like the Connection String which I can modify
> (forming string) and than just does "$dbh->connect(<> for me>>)". and
does "$dbh->close" before doing again connect to
> another database ($dbh->connect).

Ok, try this: (found on www.connectionstrings.com)

my $connstr = "Provider=SQLNCLI;"
. "Server=$server;"
. "Database=$database;";

my $dbh = DBI->connect("dbi:ADO:$connstr",$user,$pass)
|| die $DBI::errstr;

If you are using SQL Server 2005 Express, you'll need to add \EXPRESS
after the server name like this:
"Server=$server\\EXPRESS;"

Philip




                
---------------------------------
Kunjungi halaman depan Yahoo! Indonesia yang baru!

Reply via email to