Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:
$dsn=$config->{'DSN'}; $db = new Win32::ODBC("$dsn"); if (!$db) { print "Cannot connect to DSN $dsn\n"; return 0; } #@updatequeryarray is the array containing the Update statements #for eg.: UPDATE EMPLOYEE SET REMARKS='Test now for Ryan' WHERE EM +P_NO='295' AND EMP_JOIN_YEAR='200102' foreach my $query (@updatequeryarray) { $dbgstr.="\n $query"; $db->Sql($query); } $db->Close();
Here I have inserted the Update statements into the @updatequeryarray! But on execution the update statement works only the first time in the loop. I don't understand why the update statements does not work when executed thru a loop!!!
So to bypass the problem and to set the things working for the time being, I have changed the code so that each time the for loop is executed, a connection to the database is made and after updation of the single record the connection is closed.
I seek the wisdom of the Perl Monks in this!!!!
Thanks in advance
George
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Win32::ODBC - Update SQL statement
by grinder (Bishop) on Jul 25, 2001 at 16:39 UTC | |
|
Re: Win32::ODBC - Update SQL statement
by wardk (Deacon) on Jul 25, 2001 at 17:55 UTC | |
by pmas (Hermit) on Jul 25, 2001 at 22:48 UTC | |
|
Re: Win32::ODBC - Update SQL statement
by earthboundmisfit (Chaplain) on Jul 25, 2001 at 16:28 UTC | |
|
Re: Win32::ODBC - Update SQL statement
by voyager (Friar) on Jul 25, 2001 at 18:34 UTC | |
by Anonymous Monk on Jul 26, 2001 at 09:41 UTC | |
by pmas (Hermit) on Jul 26, 2001 at 19:41 UTC |