I'm using perl to insert data from a file into an MS Access database. I'd like to use the autonumber feature in Access. I can change the autonumber field to a number field and insert a number I create. How do I insert a record and allow Access to assign an autonumber?
Here's my current code:
$dbh = DBI->connect('dbi:ODBCSU Requestor DB')|| die print ("Cannot connect to the database");;
$sqlstmt = "INSERT INTO request_data VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
my $sth = $dbh->prepare($sqlstmt);
open DATA, "testdata.txt";
while (<DATA>) {
my @coldata = split(":", $_);
$sth->execute(@coldata);
}
This only works if I don't use the autonumber feature. Any suggestions would be appreciated.
Here's my current code:
$dbh = DBI->connect('dbi:ODBCSU Requestor DB')|| die print ("Cannot connect to the database");;
$sqlstmt = "INSERT INTO request_data VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
my $sth = $dbh->prepare($sqlstmt);
open DATA, "testdata.txt";
while (<DATA>) {
my @coldata = split(":", $_);
$sth->execute(@coldata);
}
This only works if I don't use the autonumber feature. Any suggestions would be appreciated.