Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Perl > Problem inserting to an Access database

Thread Tools

Problem inserting to an Access database

Alan Chiew
Posts: n/a
Hi All,

The following piece of code is what I have tried to update a simple
Access database (none of the commented out code worked either). The
connection to the database seems to be fine because I am able to read
data from it. However, when trying to add another row of data, nothing
seems to happen.

I have also checked the permissions in IIS and they seem to be set up

Any ideas would be much appreciated.


<%@LANGUAGE = PerlScript%>

use Win32::OLE;
use Win32::OLE::Const 'Microsoft ActiveX Data Objects';

$Conn = Win32::OLE->new("ADODB.Connection");
$RS = Win32::OLE->new("ADODB.Recordset");

$DBFile = "E:\\vhosts\\internaltest\\public_html\\ b";

$DSN = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};


$RS->Open("test", $Conn, adLockOptimistic, adOpenDynamic);

$fields = ["barcode", "desc"];
$values = ["C999", "this"];

$RS->AddNew($fields, $values);

#$Conn->Open("INSERT INTO test VALUES ('aaa', 'bbb')");
#$RS->Open($SQL, $Conn, 1, 1);

#$SQL = 'insert into test (barcode) VALUES "C999"';
#$RS = $Conn->Execute($SQL);

#$RS->Fields('barcode')->{value} = "ABC";

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Database Database Database Database Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase Computer Information 0 09-26-2012 09:40 AM
Inserting to Access Database MA P ASP .Net 8 09-06-2006 01:08 AM
Problem inserting record in Access Database. Shapper ASP .Net 2 07-07-2005 02:27 PM
Retrieve ID after inserting into Access database ASP .Net 0 10-28-2003 10:07 PM