Gossamer Forum
Home : General : Perl Programming :

Accessing Access Database using Win32::ODBC trouble

Quote Reply
Accessing Access Database using Win32::ODBC trouble
Hi ppl,

I've got a problem, which has puzzled me for a long time! I'm making a simple perl script that updates a MS Access database using the Win32::ODBC library from user input from a form, but it doesn't work. I've narrowed it down to the following lines:

Code:
$query = "INSERT INTO MAIN (category, subcategory, url, user) VALUES ($fields{'SelectPrimary'},
$fields{'SelectSecondary'}, $fields{'url'}, $fields{'name'})";

$conn = new Win32::ODBC("website");

if (!$conn) {
die "ODBC DSN error: [$!].\n";

}

I used this "if" statement, as the standard library error function "$conn->Error();" gives an error stating that $conn is undefined. This means that the object creation did not work. Also "$!" gives nothing.

Thanks for your help!

Simon Liu
Quote Reply
Re: [Simonliu] Accessing Access Database using Win32::ODBC trouble In reply to
You'll need to read the docs on Win32::ODBC to see where the error message is. I'd try: $Win32::ODBC::error, but it may be somewhere else.

Cheers,

Alex
--
Gossamer Threads Inc.