Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Insert Values with WIN32::OLE and MS ACCESS

by ask1about (Initiate)
on Aug 09, 2002 at 22:38 UTC ( #189079=perlquestion: print w/replies, xml ) Need Help??

ask1about has asked for the wisdom of the Perl Monks concerning the following question:

hi, I need to insert data into an MS ACCESS database
usingWIN32::OLE (not DBI or WIN32::ODBC, but WIN32::OLE). The following method works for me to read the data from thedatabase: use Win32::OLE; my $db = new Win32::OLE('ADODB.Connection'); $db->open("PROVIDER=Microsoft.Jet.OLEDB.4.0;DATA SOURCE=data.mdb"); $RS = $db->Execute("SELECT * FROM members"); $usa=$RS->Fields('name')->value; $ema=$RS->Fields('email')->value; print "$usa|$ema<br>"; $RS->MoveNext; $RS->close; $db->close; now i need something similar, but will insert
thevalues "a1" into name and "a2" into email(being examples)
into members table of the database. plz
  • Comment on Insert Values with WIN32::OLE and MS ACCESS

Replies are listed 'Best First'.
Re: Insert Values with WIN32::OLE and MS ACCESS
by simon.proctor (Vicar) on Aug 09, 2002 at 23:15 UTC
    Take a look at my node: on Retrieving the last insert ID with Access. You can use that as a basis for what you want as it covers inserting data using a recordset.

    For anything else you should read up on ADO.
      I did before it didnt't help.
        im guessing this might be a prob with my hosting company. I will consult it with them cuz it worked on my other host.
Re: Insert Values with WIN32::OLE and MS ACCESS
by cacharbe (Curate) on Aug 09, 2002 at 23:04 UTC
    What have you tried?

    Just about everything you need is right there in front of you. What are you having problems with? The SQL statement? How to receive the response from the database object?


    Flex the Geek

      Ye i tried many many times, but it dont work i tried AddNew() method and INSERT INTO members (name,email) VALUES ('a1','a2') but it doesnt insert.

      Ive tried many ways yet none worked, thats the reason why I'm asking.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://189079]
Approved by cacharbe
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others having an uproarious good time at the Monastery: (3)
As of 2021-12-05 05:32 GMT
Find Nodes?
    Voting Booth?
    R or B?

    Results (31 votes). Check out past polls.