Hey,
I got the script down to this:
#!/perl/bin/perl
use Win32::ODBC;
use win32;
use CGI qw(:standard);
$data="data.csv";
my (@statement); # array of sql statements
my $db=new Win32::ODBC("DSN=test;UID=;PWD=");
### report connection status
if (!$db) {
die "\nunable to connect to database! $!";
}
### Open File for Reading
open(FR, "< $data") || die "cannot open $data for reading: $!";
while(<FR>) {
my ($d1, $d2, $d3, $d4, $d5, $d6, $d7, $d8) = split /\,/;
($d1) = "$d1\@test\.com";
($d2) =~ s/LBAM\///;
($d2) =~ s/LBAS\///;
($d2) =~ s/LBEU\///;
### Write to Database
push @statement, "
INSERT INTO NEW
(mail_alias, NT_login, firstname, middle_init, surname,
profit_loss, dept, org_unit_name)
VALUES
('$d1', '$d2', '$d3', '$d4', '$d5', '$d6', '$d7', '$d8')
";
}
### Close the files
close(FR) || die "cant close $data: $!";
### Close the database
$db->Close();
And it still doesn't work. I don't know what's wrong because i'm not getting any errors. Can anyone help?