private void updateRecords(int iFlag)

        {

            OleDbConnection cnn = new OleDbConnection(variables.strCnn);

 

            string updateSQL = "";

 

            switch (iFlag)

            {   //select update SQL to run

                case 0: updateSQL = "UPDATE estimate_procedure SET ACTIVE = " + chkActive.Checked + " WHERE ((ESTIMATE_ID = " + usm_variables.iEstimateID + "))";

                    break;

                case 1:

                    updateSQL = "UPDATE estimates SET SUB_STATION = '" + sub_station.Text + "', " + "PAINT_SYSTEM = '" + paint_system.Text + "', " +

                    "ITEM_NUMBER = '" + item_number.Text + "', " + " UNIT_NUMBER = " + returnNullValue(unit_number.Text) + ", " + " MANUFACTURER = '" + manufacturer.Text + "', " +

                    "SIZE_AMPS = '" + size_amps.Text + "', " + " VOLTAGE = '" + voltage.Text + "', " + " COMPANY_NUMBER1 = '" + company_number1.Text + "', " +

                    "COMPANY_NUMBER2 = '" + company_number2.Text + "', " + " SERIAL_NUMBER1 = '" + serial_number1.Text + "', SERIAL_NUMBER2 = '" +

                    serial_number2.Text + "', " + " MISCELLANEOUS1 = '" + miscellaneous1.Text + "', " + " MISCELLANEOUS2 = '" + miscellaneous2.Text +

                    "', TOTAL_TANK_AREA = " + TOTAL_TANK_AREA.Text + ", TOTAL_RADIATOR_AREA = " + TOTAL_RADIATOR_AREA.Text + " WHERE ((ESTIMATE_ID = " + usm_variables.iEstimateID + "))";

                    break;

                case 2:

                    //DATE and PRICE are commented out because the data has not been located yet

                    updateSQL = "UPDATE company_info SET ESTIMATENO = " + usm_variables.estimateNumber + ", SHORTNAME = '" + SHORTNAME.Text + "', " + 

                    "LONGNAME = '" + LONGNAME.Text + "', " + //" DATE = " + DATE.Text + ", " +

                    "CITY = '" + CITY.Text + "', " + " MANHOUR = " + returnNullValue(MANHOUR.Text) + ", " +

                    "X2 = " + 0 +

                    //", PRICE = " + PRICE.Text + ", " +

                    ", PHONE = '" + PHONE.Text + "', " +

                    " CONTACT = '" + CONTACT.Text + "' WHERE ((ESTIMATE_ID = " + usm_variables.iEstimateID + "))";

                    break;

               

 

                default:

                    break;

            }

 

            try

            {

                cnn.Open();

                OleDbTransaction oTrans = cnn.BeginTransaction();

                try

                {

                    OleDbCommand cmd = new OleDbCommand(updateSQL, cnn);

                    cmd.Transaction = oTrans;

                    cmd.ExecuteNonQuery();

 

                    oTrans.Commit();

                    cnn.Close();

                }

 

                catch (Exception ex)

                {

                    oTrans.Rollback();

                    throw ex;

                }

 

            }

        finally

        {

        cnn.Close();

        }

        }