programming-examples/perl/Win32/Creating a Database Table.pl

17 lines
542 B
Perl
Raw Normal View History

2019-11-15 12:59:38 +01:00
use Win32::ODBC;
$DSN = "Email Contacts";
my $myDb = Win32::ODBC->new($DSN);
if (! $myDb){
print "Failed to Connect $DSN\n";
Win32::ODBC::DumpError();
die;
}
$SQLStatment = qq|Create Table emailContacts(address char(40) NOT NULL,
lastName char(20),
firstName char(10),
MI char (2))|;
if ($myDb->Sql($SQLStatment)){
print "Error creating the initial Table\n";
Win32::ODBC->DumpError();
}
$myDb->Close();