Hello everyone, I am having troubles with updating a memo field in an access database.
Currently I am using the following my $dbh = DBI->connect("dbi:ADO:$dsn", $user, $password, $att ) or die $DBI::errstr; sub update_country_releases { my $db = shift; foreach (keys %country_releases) { my $primkey = $_.":ZZZ"; my $sth = $db->prepare('UPDATE PROD_INT set COUNTRY = \''.$country_releases{$_}.'\' where ROW_ID = \''.$primkey.'\''); $sth->execute; if ($sth->errstr) { print $sth->errstr; } } } No error during insert. However, I have written a test sub routine which compares what should be there with what actually is in the database. This sub routine returns an error. Looking into it, I realized that the only difference is the length of the value. I tried using ADO OLE: my $conn = Win32::OLE->new("ADODB.Connection"); my $rs = Win32::OLE->new("ADODB.Recordset"); my $db = "db.mdb"; $dsn = "PROVIDER=MSDASQL;DRIVER={Microsoft Access Driver (*.mdb)};DBQ=$db;UID=$user;PWD=$password;"; $conn->Open($dsn); sub update_country_releases { my ($rs, $conn) = @_; foreach (keys %country_releases) { my $primkey = $_.":ZZZ"; my $SQL = "SELECT COUNTRY FROM PROD_INT WHERE ROW_ID = \"$primkey\""; $rs->Open($SQL, $conn, 1, 1); [...] } } I have to update a single-row table, my code for this works: sub update_sub_version { my ($rs, $conn, $ver) = @_; $rs->Open("DB_PROPERTIES", $conn, adLockOptimistic, adOpenDynamic); my $fields = "Sub_Version"; my $values = $ver; $rs->Update ($fields, $values); $rs->Close(); } However, I do not even manage to get the RecordSet to contain the 16 entries it should have. I figued it would work like this: I have the record set, iterate over it, update the field I want to update and then move on to the next entry. But it does not, my RecordSet is empty. Is there a way to get this working via DBI at all? If not, could someone please post an example how to do foreach (keys %country_releases) { my $primkey = $_.":ZZZ"; my $sth = $db->prepare('UPDATE PROD_INT set COUNTRY = \''.$country_releases{$_}.'\' where ROW_ID = \''.$primkey.'\''); $sth->execute; } using a RecordSet? This is giving me a severe headache; I am used to working on Solaris, so I did not anticipate any difficulties with such rather trivial thing ... _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs