> -----Original Message----- > From: perl-win32-users-boun...@listserv.activestate.com [mailto:perl- > win32-users-boun...@listserv.activestate.com] On Behalf Of Claus Kick > Sent: 07 July 2011 11:49 > To: Perl-Win32-Users@listserv.ActiveState.com > Subject: MS Access Update Memo Field with 750 characters > > 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.
Is it possible that the SQL parser is changing the strings? One way to avoid that is to use parameter binding. Also, I suggest using Perl's quoting operators which can make your SQL statements easier to read. So, assuming RaiseError => 1 when you connect, your sub could look something like this. sub update_country_releases { my $db = shift; my $sql = qq{UPDATE PROD_INT set COUNTRY = ? where ROW_ID = ?}; my $sth = $db->prepare($sql); foreach (keys %country_releases) { $sth->execute($country_releases{$_}, $_ . ":ZZZ"); } } HTH -- Brian Raven Please consider the environment before printing this e-mail. This e-mail may contain confidential and/or privileged information. If you are not the intended recipient or have received this e-mail in error, please advise the sender immediately by reply e-mail and delete this message and any attachments without retaining a copy. Any unauthorised copying, disclosure or distribution of the material in this e-mail is strictly forbidden. _______________________________________________ Perl-Win32-Users mailing list Perl-Win32-Users@listserv.ActiveState.com To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs