Using Database Operations

The Update Operation

ProcedureTo perform an update operation on a table

  1. Execute the update() method.

  2. Using a while loop together with next(), move to the row that you want to update.

  3. Assign updating value(s) to the fields of the table OTD

  4. Update the row by calling updateRow().


    package prjSQLServer_JCDjcdALL;
    
    
    public class jcdUpdate
    {
    
    public com.stc.codegen.logger.Logger logger;
    public com.stc.codegen.alerter.Alerter alerter;
    public com.stc.codegen.util.CollaborationContext collabContext;
    public com.stc.codegen.util.TypeConverter typeConverter;
    
        public void receive( com.stc.connector.appconn.file.FileTextMessage input,
     otdSQLServer.OtdSQLServerOTD otdSQLServer_1, com.stc.connector.appconn.file.
    FileApplication FileClient_1 )
            throws Throwable
        {
            FileClient_1.setText( "Updating the Rate and Last_update fields .. " );
            FileClient_1.write();
            otdSQLServer_1.getDb_employee().update( input.getText() );
            while (otdSQLServer_1.getDb_employee().next()) {
            otdSQLServer_1.getDb_employee().setLAST_NAME( "Krishna" );
            otdSQLServer_1.getDb_employee().setFIRST_NAME( "Kishore" );
            otdSQLServer_1.getDb_employee().updateRow();
            }
            FileClient_1.setText( "Update Done." );
            FileClient_1.write();
        }
    
    }