Insert record with Perl (1 Viewer)

bfackrell

New member
Local time
Today, 04:55
Joined
May 26, 2010
Messages
2
I’m trying to insert a new record into an MS Access (2002-2003) database using Perl. My instructor's example has me getting the last record ID and using that to generate the next ID.

Two things:

1- When I do this the way the instructor illustrates (based on existing ID) using this code:
if($db->Sql("SELECT MAX(ID) lastID FROM Test"))
{
print "SQL Error: " . $db->Error() . "\n";
$db->Close();
exit;
}
Can anybody tell me why I get this error:
SQL Error: [-3100] [1] [0] "[Microsoft][ODBC Microsoft Access Driver] Syntax error (missing operator) in query expression 'MAX(ID) lastID'."
2- If my ID field is set to “AutoNumber” shouldn’t I be able to simply insert and new record (with no ID)? I’ve attempted that with no success.
 

Users who are viewing this thread

Top Bottom