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;
%> 3 2298
I had problems with AddNew method; for some wierd reason I couldn't make
it work with lists of fields. I ended up looping through the fields.
Have you tried to use the same SQL and VBA code directly in the DB? Is
the other field than Barcode required and not autonumber?
Pavel
Alan Chiew wrote: 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; %>
On Wed, 24 Sep 2003 09:35:18 -0600, Pavel Romashkin
<pa*************@hotmail.com> wrote: I had problems with AddNew method; for some wierd reason I couldn't make it work with lists of fields. I ended up looping through the fields. Have you tried to use the same SQL and VBA code directly in the DB? Is the other field than Barcode required and not autonumber? Pavel
Hi Pavel,
I have tried the SQL code in the DB and it works fine. The other
field, desc, is just another text field and is not required.
Cheers,
Alan
I don't know what to suggest. Looks to me that executing SQL should have
worked. Try re-posting your original problem again - maybe someone will
have a better idea.
Good luck,
Pavel
Alan Chiew wrote: On Wed, 24 Sep 2003 09:35:18 -0600, Pavel Romashkin <pa*************@hotmail.com> wrote:
I had problems with AddNew method; for some wierd reason I couldn't make it work with lists of fields. I ended up looping through the fields. Have you tried to use the same SQL and VBA code directly in the DB? Is the other field than Barcode required and not autonumber? Pavel
Hi Pavel,
I have tried the SQL code in the DB and it works fine. The other field, desc, is just another text field and is not required.
Cheers, Alan This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: DarthMacgyver |
last post by:
Hello,
I recently wrote a survey application. Each question is very similar.
The first questions gives me a problem when there are multiple people
taking the survey (The Database connection...
|
by: Jared Evans |
last post by:
I developed a console application that will continually check a message
queue to watch for any incoming data that needs to be inserted into MS
SQL database.
What would be a low-cost method I...
|
by: Erica |
last post by:
Hi,
I have searched everywhere, and I can't seem to find the answer to my
problem. I am trying to write a very simple piece of ASP code to
insert a record into a field in a database. Ultimately...
|
by: yzlin04 |
last post by:
Hello,
I'm new in vb.net. I have a problem in inserting a new row to a MS Access database table.
There is no error message comes out when i run my program, but when i check my MS Access table,...
|
by: Surya |
last post by:
Dear All,
I have problem on inserting a record to database..Although it looked
easy.. i have caught up with following issue .. please go ahead and
help me to find solution
I Need to insert...
|
by: dav3 |
last post by:
Alright folks I am in need of a lil guidance/assistance here. I have a program which reads in a txt file. This txt file contains lines of the form
January 3, 2007, 85.8
Now each line of the txt...
|
by: SL Culby |
last post by:
Hello everyone, I have a project where I pull SQL Server data put it into a dataset and now I have to put the dataset data into an Access Database. The dataset currently is over 2000 row, so looping...
|
by: ashes |
last post by:
Hi,
I am creating an ecommerce website using Microsoft Visual Studio, VB.Net and MS Access 2003. I am new to VB.Net
When someone wants to register on the website, they fill out a form and the...
|
by: AlexanderDeLarge |
last post by:
Hi!
I got a problem that's driving me crazy and I'm desperately in need of help.
I'll explain my scenario:
I'm doing a database driven site for a band, I got these tables for their discography...
|
by: hakkatil |
last post by:
Hi to all,
I have a page that inserts excel sheet to access database. I am using asp. What I want to do is to check the inserting record if it is in the database. Basicly checking the dublicate...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
| |