34 lines
673 B
Perl
34 lines
673 B
Perl
#!/usr/bin/perl
|
|
|
|
use warnings;
|
|
use strict;
|
|
use DBI;
|
|
use DBD::ODBC;
|
|
|
|
my $dbh = DBI->connect( "dbi:ODBC:employeeDB", "", "", { RaiseError => 1 } );
|
|
|
|
my $IDdel = "1";
|
|
|
|
my $query = "DELETE FROM employee WHERE EmployeeID = '$IDdel'";
|
|
print( "$query \n\n" );
|
|
$dbh->do( $query );
|
|
|
|
my $sth = $dbh->prepare( q{ select * FROM employee } );
|
|
|
|
$sth->execute();
|
|
|
|
my @array;
|
|
|
|
while ( @array = $sth->fetchrow_array() ) {
|
|
write( STDOUT );
|
|
}
|
|
|
|
# Clean up
|
|
warn( $DBI::errstr ) if $DBI::err;
|
|
$dbh->disconnect();
|
|
$sth->finish();
|
|
|
|
format STDOUT =
|
|
@<<<<<<@<<<<<<<<<@<<<<<<<<<<@<<<<<@<<<<<<<<<<<
|
|
$array[ 0 ], $array[ 1 ], $array[ 2 ], $array[ 3 ], $array[ 4 ]
|