[ic] SQL write to a table

Boyer, Jim boyerj at wsu.edu
Thu Dec 2 19:09:23 EST 2004


I am trying to write data to an extra table I have created in the
catalog database.  I am attempting this from a user tag and using the
dbi method.  I am running IC 5.2.0 and the database is MySql.  The table
is recognized in the IC Admin interface and I can create entries via the
Admin interface.  Here is the code I am attempting to use without
success:


::logDebug(qq{\nBEFORE SQL });

   # store the license data in the database under record number
   my $dbh = $Sql{state_licenses}
             or return HTML "Database not shared.";

   my $q = 'INSERT INTO state_licenses (order_number, state, license)'
          . ' VALUES ("0000110", "WA", "WSDL7777")';

   my $sth = $dbh->prepare( $q )
             or return HTML "Couldn't open database";

   $rc = $sth->execute()
             or return HTML "Execute sql failed";

   $sth->finish();
   $dbh->disconnect();

::logDebug(qq{\nAFTER SQL });

This should be simple, but I can't seem to find the correct method to
make it happen.  

Thanks for any assistance,

-------------------------------
Jim Boyer
Systems Programmer
College of Agriculture, Human, and Natural Resource Sciences 
Washington State University
509.335.2838




More information about the interchange-users mailing list