Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

Problem inserting to an Access database

 
 
Alan Chiew
Guest
Posts: n/a
 
      09-23-2003
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
fine.

Any ideas would be much appreciated.

Regards,
Alan

<%@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\\ITRtest.md b";

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

$Conn->Open($DSN);

$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->AddNew;
#$RS->Fields('barcode')->{value} = "ABC";
#$RS->Update;


$RS->Close;
$Conn->Close;
%>
 
Reply With Quote
 
 
 
Reply

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 scott93727@gmail.com Computer Information 0 09-27-2012 02:43 AM
DataBase DataBase DataBase DataBase scott93727@gmail.com 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 refer_to_website@nospam.com ASP .Net 0 10-28-2003 10:07 PM



Advertisments