Sure, should have down so from the start
use DBI;
$DSN='.....';
$dbh = DBI->connect("dbi:ODBC:$DSN")
or die "$DBI::errstr\n";
my $sth = $dbh->prepare('SELECT * FROM Test WHERE ServerName = ?')
or die "Couldn't Prepare statement: " . $dbh->errstr;
print "Enter ServerName> ";
while ($ServerName = <>)
{
my @data;
chomp $ServerName;
$sth->execute($ServerName);
# Read the matching records and print out
while (@data = $sth->fetchrow_array())
{
my $ServerType = $data[1];
my $WeekDays = $data[5];
print "\t$ServerType $ServerName $WeekDays\n";
}
if ($sth->row == 0)
{
print "No servers matched \n\n";
}
$sth->finish;
print"\n";
print "Enter ServerName> ";
}
$dbh->disconnect;
thanks