From:  "[EMAIL PROTECTED]" <[EMAIL PROTECTED]>
> I am struck on how to write data into a MS-Access data base.
> 
> I know how to retrieve data. I am using Win32::ODBC -- fetchRow to
> retrieve a complete row. I need to write this row into another table.
> 
> Kindly suggest on how to go about this.

Use DBI and DBD::ODBC instead. Win32::ODBC should not be used in new 
script except for maintaining the DSNs.

If you want to copy a row from one table to another it's better to do 
it directly:

 INSERT INTO SecondTable (The, List, Of, Columns)
 SELECT The, List, Of, Possibly+Computed, Columns
   FROM FirstTable
  WHERE some = condition

If you do need to copy the row to a different database you may do 
something like

my $sth_ins = $db2->prepare(
  'INSERT INTO SecondTable (The, List, Of, Columns) VALUES (?,?,?,?)'
);

my $sth_sel = $db1->prepare(
  'SELECT The, List, Of, Possibly+Computed, Columns
   FROM FirstTable
  WHERE some = condition'
);

$sth_sel->execute();
while (my $row = $sth_sel->fetchrow_arrayref()) {
 $sth_ins->execute(@$row);
}


Jenda
===== [EMAIL PROTECTED] === http://Jenda.Krynicky.cz =====
When it comes to wine, women and song, wizards are allowed 
to get drunk and croon as much as they like.
        -- Terry Pratchett in Sourcery


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
http://learn.perl.org/


Reply via email to