public void loadvalues(bool p_bScenarioCopy)
        {
            int x;
            ProcessorScenarioTools oTools = new ProcessorScenarioTools();

            //Reset m_oProcessorScenarioItem_Collection so we don't get duplicates when we loadAll down below
            m_oProcessorScenarioItem_Collection = new ProcessorScenarioItem_Collection();
            lvProcessorScenario.Items.Clear();
            System.Windows.Forms.ListViewItem entryListItem = null;
            this.m_oLvAlternateColors.InitializeRowCollection();
            this.m_oLvAlternateColors.ReferenceAlternateBackgroundColor   = frmMain.g_oGridViewAlternateRowBackgroundColor;
            this.m_oLvAlternateColors.ReferenceAlternateForegroundColor   = frmMain.g_oGridViewRowForegroundColor;
            this.m_oLvAlternateColors.ReferenceBackgroundColor            = frmMain.g_oGridViewRowBackgroundColor;
            this.m_oLvAlternateColors.ReferenceForegroundColor            = frmMain.g_oGridViewRowForegroundColor;
            this.m_oLvAlternateColors.ReferenceSelectedRowBackgroundColor = frmMain.g_oGridViewSelectedRowBackgroundColor;
            this.m_oLvAlternateColors.ReferenceListView   = this.lvProcessorScenario;
            this.m_oLvAlternateColors.CustomFullRowSelect = true;
            if (frmMain.g_oGridViewFont != null)
            {
                this.lvProcessorScenario.Font = frmMain.g_oGridViewFont;
            }

            ado_data_access oAdo = new ado_data_access();
            string          strProcessorScenario = "";
            string          strFullDetailsYN     = "N";

            if (p_bScenarioCopy == false)
            {
                string[] strScenarioArray = null;
                if (!ReferenceOptimizerScenarioForm.m_bProcessorUsingSqlite)
                {
                    strScenarioArray = loadScenarioArray(oAdo);
                }
                else
                {
                    strScenarioArray = loadScenarioArraySqlite();
                }
                if (strScenarioArray == null)
                {
                    return;
                }

                for (x = 0; x <= strScenarioArray.Length - 1; x++)
                {
                    //
                    //LOAD PROJECT DATATASOURCES INFO
                    //
                    m_oQueries.m_oFvs.LoadDatasource       = true;
                    m_oQueries.m_oFIAPlot.LoadDatasource   = true;
                    m_oQueries.m_oProcessor.LoadDatasource = true;
                    m_oQueries.m_oReference.LoadDatasource = true;
                    m_oQueries.LoadDatasources(true, ReferenceOptimizerScenarioForm.m_bProcessorUsingSqlite, "processor", strScenarioArray[x]);
                    if (!ReferenceOptimizerScenarioForm.m_bProcessorUsingSqlite)
                    {
                        m_oQueries.m_oDataSource.CreateScenarioRuleDefinitionTableLinks(
                            m_oQueries.m_strTempDbFile,
                            frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim(),
                            "P");
                        oTools.LoadAll(m_oQueries.m_strTempDbFile, m_oQueries, strScenarioArray[x], m_oProcessorScenarioItem_Collection);
                    }
                    else
                    {
                        oTools.LoadAllSqlite(m_oQueries, strScenarioArray[x], m_oProcessorScenarioItem_Collection);
                    }
                }
            }
            else
            {
                foreach (ProcessorScenarioItem psItem in ReferenceOptimizerScenarioForm.m_oOptimizerScenarioItem.m_oProcessorScenarioItem_Collection)
                {
                    m_oProcessorScenarioItem_Collection.Add(psItem);
                    if (psItem.Selected == true)
                    {
                        strProcessorScenario = psItem.ScenarioId;
                        strFullDetailsYN     = psItem.DisplayFullDetailsYN;
                    }
                }
            }
            for (x = 0; x <= m_oProcessorScenarioItem_Collection.Count - 1; x++)
            {
                entryListItem = lvProcessorScenario.Items.Add(" ");

                entryListItem.UseItemStyleForSubItems = false;
                this.m_oLvAlternateColors.AddRow();
                this.m_oLvAlternateColors.AddColumns(x, lvProcessorScenario.Columns.Count);


                entryListItem.SubItems.Add(m_oProcessorScenarioItem_Collection.Item(x).ScenarioId);
                entryListItem.SubItems.Add(m_oProcessorScenarioItem_Collection.Item(x).Description);
            }
            this.m_oLvAlternateColors.ListView();

            if (p_bScenarioCopy == false)
            {
                string strScenarioMDB =
                    frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() + "\\" +
                    Tables.OptimizerScenarioRuleDefinitions.DefaultScenarioTableDbFile;


                string strConn = oAdo.getMDBConnString(strScenarioMDB, "", "");
                oAdo.OpenConnection(strConn);

                if (oAdo.TableExist(oAdo.m_OleDbConnection, Tables.OptimizerScenarioRuleDefinitions.DefaultScenarioProcessorScenarioSelectTableName))
                {
                    oAdo.m_strSQL = "SELECT * FROM " + Tables.OptimizerScenarioRuleDefinitions.DefaultScenarioProcessorScenarioSelectTableName + " " +
                                    "WHERE TRIM(UCASE(scenario_id)) = '" +
                                    ReferenceOptimizerScenarioForm.uc_scenario1.txtScenarioId.Text.Trim().ToUpper() + "';";
                    oAdo.SqlQueryReader(oAdo.m_OleDbConnection, oAdo.m_strSQL);

                    if (oAdo.m_OleDbDataReader.HasRows)
                    {
                        while (oAdo.m_OleDbDataReader.Read())
                        {
                            if (oAdo.m_OleDbDataReader["processor_scenario_id"] != System.DBNull.Value &&
                                oAdo.m_OleDbDataReader["processor_scenario_id"].ToString().Trim().Length > 0)
                            {
                                strProcessorScenario = oAdo.m_OleDbDataReader["processor_scenario_id"].ToString().Trim();
                            }
                            if (oAdo.m_OleDbDataReader["FullDetailsYN"] != System.DBNull.Value &&
                                oAdo.m_OleDbDataReader["FullDetailsYN"].ToString().Trim().Length > 0)
                            {
                                strFullDetailsYN = oAdo.m_OleDbDataReader["FullDetailsYN"].ToString().Trim();
                            }
                        }
                    }
                    oAdo.m_OleDbDataReader.Close();
                    oAdo.CloseConnection(oAdo.m_OleDbConnection);
                }
                else
                {
                    frmMain.g_oTables.m_oOptimizerScenarioRuleDef.CreateScenarioProcessorScenarioSelectTable(oAdo, oAdo.m_OleDbConnection, Tables.OptimizerScenarioRuleDefinitions.DefaultScenarioProcessorScenarioSelectTableName);
                }
            }
            if (lvProcessorScenario.Items.Count > 0)
            {
                for (x = 0; x <= lvProcessorScenario.Items.Count - 1; x++)
                {
                    if (lvProcessorScenario.Items[x].SubItems[COL_SCENARIOID].Text.Trim().ToUpper() ==
                        strProcessorScenario.ToUpper())
                    {
                        lvProcessorScenario.Items[x].Checked = true;
                        for (int y = 0; y <= ReferenceOptimizerScenarioForm.uc_scenario_processor_scenario_select1.m_oProcessorScenarioItem_Collection.Count - 1; y++)
                        {
                            if (lvProcessorScenario.Items[x].SubItems[COL_SCENARIOID].Text.Trim().ToUpper() ==
                                ReferenceOptimizerScenarioForm.uc_scenario_processor_scenario_select1.m_oProcessorScenarioItem_Collection.Item(y).ScenarioId.Trim().ToUpper())
                            {
                                ReferenceOptimizerScenarioForm.uc_scenario_cond_filter1.strLowSlope =
                                    ReferenceOptimizerScenarioForm.uc_scenario_processor_scenario_select1.m_oProcessorScenarioItem_Collection.Item(y).m_oHarvestMethod.SteepSlopePercent;

                                ReferenceOptimizerScenarioForm.uc_scenario_cond_filter1.strSteepSlope =
                                    ReferenceOptimizerScenarioForm.uc_scenario_processor_scenario_select1.m_oProcessorScenarioItem_Collection.Item(y).m_oHarvestMethod.SteepSlopePercent;
                            }
                        }
                        break;
                    }
                }
                if (x <= lvProcessorScenario.Items.Count - 1)
                {
                    lvProcessorScenario.Items[0].Selected = true;
                }
            }

            if (strFullDetailsYN == "Y")
            {
                chkFullDetails.Checked = true;
            }
            else
            {
                chkFullDetails.Checked = false;
            }
        }
        public void loadvalues()
        {
            m_bSyncd = false;
            ado_data_access oAdo = new ado_data_access();

            int x         = 0;
            int intPathNF = 0;
            int intRootNF = 0;


            this.lvDatasources.Clear();

            ado_data_access p_ado = new ado_data_access();

            this.lvDatasources.Columns.Add(" ", 2, HorizontalAlignment.Left);
            this.lvDatasources.Columns.Add("DataSource", 100, HorizontalAlignment.Left);
            this.lvDatasources.Columns.Add("Scenario", 100, HorizontalAlignment.Left);
            this.lvDatasources.Columns.Add("TableType", 50, HorizontalAlignment.Left);
            this.lvDatasources.Columns.Add("Path", 100, HorizontalAlignment.Left);
            this.lvDatasources.Columns.Add("PathFound", 100, HorizontalAlignment.Left);
            this.lvDatasources.Columns.Add("Synchronized", 100, HorizontalAlignment.Left);

            oAdo.OpenConnection(oAdo.getMDBConnString(m_strRandomPathAndFile, "", ""));



            oAdo.m_strSQL =
                "SELECT 'Project' AS DataSource, 'NA' AS Scenario,table_type AS TableType,path FROM project_datasource ";

            if (oAdo.TableExist(oAdo.m_OleDbConnection, "optimizer_scenario"))
            {
                oAdo.m_strSQL = oAdo.m_strSQL +
                                "UNION " +
                                "SELECT 'TreatmentOptimizer' AS DataSource, Scenario_Id AS Scenario,'NA' AS TableType,path FROM optimizer_scenario ";
            }
            if (oAdo.TableExist(oAdo.m_OleDbConnection, "optimizer_scenario_datasource"))
            {
                oAdo.m_strSQL = oAdo.m_strSQL +
                                "UNION " +
                                "SELECT 'TreatmentOptimizer' AS DataSource, Scenario_Id AS Scenario,table_type AS TableType, path FROM optimizer_scenario_datasource ";
            }
            if (oAdo.TableExist(oAdo.m_OleDbConnection, "processor_scenario"))
            {
                oAdo.m_strSQL = oAdo.m_strSQL +
                                "UNION " +
                                "SELECT 'Processor' AS DataSource, Scenario_Id AS Scenario,'NA' AS TableType,path FROM processor_scenario ";
            }
            if (oAdo.TableExist(oAdo.m_OleDbConnection, "processor_scenario_datasource"))
            {
                oAdo.m_strSQL = oAdo.m_strSQL +
                                "UNION " +
                                "SELECT 'Processor' AS DataSource, Scenario_Id AS Scenario,table_type AS TableType, path FROM processor_scenario_datasource ";
            }

            oAdo.SqlQueryReader(oAdo.m_OleDbConnection, oAdo.m_strSQL);

            if (oAdo.m_OleDbDataReader.HasRows)
            {
                while (oAdo.m_OleDbDataReader.Read())
                {
                    // Don't add appData data sources to the grid
                    if (oAdo.m_OleDbDataReader["Path"].ToString().IndexOf("@@appdata@@") == -1)
                    {
                        System.Windows.Forms.ListViewItem entryListItem =
                            this.lvDatasources.Items.Add(" ");
                        entryListItem.UseItemStyleForSubItems = false;
                        this.lvDatasources.Items[x].SubItems.Add(oAdo.m_OleDbDataReader["DataSource"].ToString());
                        this.lvDatasources.Items[x].SubItems.Add(oAdo.m_OleDbDataReader["Scenario"].ToString());
                        this.lvDatasources.Items[x].SubItems.Add(oAdo.m_OleDbDataReader["TableType"].ToString());
                        this.lvDatasources.Items[x].SubItems.Add(oAdo.m_OleDbDataReader["Path"].ToString());
                        if (System.IO.Directory.Exists(oAdo.m_OleDbDataReader["Path"].ToString().Trim()))
                        {
                            ListViewItem.ListViewSubItem FileStatusSubItem =
                                entryListItem.SubItems.Add("Yes");
                            FileStatusSubItem.ForeColor = System.Drawing.Color.White;
                            FileStatusSubItem.BackColor = System.Drawing.Color.Green;
                        }
                        else
                        {
                            ListViewItem.ListViewSubItem FileStatusSubItem =
                                entryListItem.SubItems.Add("No");
                            FileStatusSubItem.ForeColor = System.Drawing.Color.White;
                            FileStatusSubItem.BackColor = System.Drawing.Color.Red;
                            intPathNF++;
                        }
                        if (oAdo.m_OleDbDataReader["Path"].ToString().ToUpper().Contains(lblCurrentProjectRootFolder.Text.Trim().ToUpper()))
                        {
                            ListViewItem.ListViewSubItem SyncStatusSubItem =
                                entryListItem.SubItems.Add("Yes");
                            SyncStatusSubItem.ForeColor = System.Drawing.Color.White;
                            SyncStatusSubItem.BackColor = System.Drawing.Color.Green;
                        }
                        else
                        {
                            ListViewItem.ListViewSubItem SyncStatusSubItem =
                                entryListItem.SubItems.Add("No");
                            SyncStatusSubItem.ForeColor = System.Drawing.Color.White;
                            SyncStatusSubItem.BackColor = System.Drawing.Color.Red;
                            intRootNF++;
                        }
                        x++;
                    }
                }
                lblFolderPaths.Text = intPathNF.ToString().Trim();
                lblProjectRootFolderNotFound.Text = intRootNF.ToString().Trim();
                oAdo.m_OleDbDataReader.Close();
            }
            if (intRootNF > 0)
            {
                btnAnalyze.Enabled = true;
            }
            else
            {
                btnAnalyze.Enabled = false;
            }
            oAdo.m_OleDbConnection.Close();
            oAdo = null;
        }
        public void savevalues()
        {
            int    x;
            string strSpcGrp     = "";
            string strDbhGrp     = "";
            string strMerchValue = "";
            string strChipValue  = "";
            string strWoodBin    = "";
            string strSql        = "";

            SQLite.ADO.DataMgr oDataMgr = null;
            if (!ReferenceProcessorScenarioForm.m_bUsingSqlite)
            {
                //
                //DELETE THE CURRENT SCENARIO RECORDS
                //
                m_oAdo.m_strSQL = "DELETE FROM scenario_tree_species_diam_dollar_values " +
                                  "WHERE TRIM(scenario_id)='" + this.ScenarioId.Trim() + "'";
                m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
                //
                //DELETE THE WORK TABLE
                //
                if (m_oAdo.TableExist(m_oAdo.m_OleDbConnection, "spcgrp_dbhgrp"))
                {
                    m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, "DROP TABLE spcgrp_dbhgrp");
                }
                //
                //CREATE AND POPULATE WORK TABLE
                //
                m_oAdo.m_strSQL = "CREATE TABLE spcgrp_dbhgrp (" +
                                  "species_group INTEGER," +
                                  "species_label CHAR(50)," +
                                  "diam_group INTEGER," +
                                  "diam_class CHAR(15))";
                m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);

                foreach (ProcessorScenarioItem.SpcGroupItem objSpcGroup in ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.m_oSpcGroupItem_Collection)
                {
                    foreach (ProcessorScenarioItem.TreeDiamGroupsItem objDiamGroup in ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.m_oTreeDiamGroupsItem_Collection)
                    {
                        // INITIALIZE RECORDS IN WORK TABLE
                        m_oAdo.m_strSQL = "INSERT INTO spcgrp_dbhgrp (species_group,species_label, diam_group, diam_class) " +
                                          "VALUES (" + objSpcGroup.SpeciesGroup + ",'" + objSpcGroup.SpeciesGroupLabel + "'," +
                                          objDiamGroup.DiamGroup + ",'" + objDiamGroup.DiamClass + "')";
                        m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
                        //
                        //INSERT SCENARIO RECORDS
                        //
                        m_oAdo.m_strSQL = "INSERT INTO scenario_tree_species_diam_dollar_values (scenario_id,species_group,diam_group) " +
                                          "VALUES ('" + ScenarioId.Trim() + "'," + objSpcGroup.SpeciesGroup + "," +
                                          objDiamGroup.DiamGroup + ")";
                        m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
                    }
                }
            }
            else
            {
                oDataMgr = new SQLite.ADO.DataMgr();
                string strScenarioDB =
                    frmMain.g_oFrmMain.frmProject.uc_project1.txtRootDirectory.Text.Trim() +
                    "\\processor\\" + Tables.ProcessorScenarioRuleDefinitions.DefaultSqliteDbFile;
                oDataMgr.OpenConnection(oDataMgr.GetConnectionString(strScenarioDB));
                if (oDataMgr.m_intError != 0)
                {
                    m_intError = oDataMgr.m_intError;
                    m_strError = oDataMgr.m_strError;
                    oDataMgr   = null;
                    return;
                }
                m_intError = 0;
                m_strError = "";
                //
                //DELETE THE CURRENT SCENARIO RECORDS
                //
                oDataMgr.m_strSQL = "DELETE FROM scenario_tree_species_diam_dollar_values " +
                                    "WHERE TRIM(scenario_id)='" + this.ScenarioId.Trim() + "'";
                oDataMgr.SqlNonQuery(oDataMgr.m_Connection, oDataMgr.m_strSQL);
                //
                //DELETE THE WORK TABLE
                //
                if (oDataMgr.TableExist(oDataMgr.m_Connection, "spcgrp_dbhgrp"))
                {
                    oDataMgr.SqlNonQuery(oDataMgr.m_Connection, "DROP TABLE spcgrp_dbhgrp");
                }
                //
                //CREATE AND POPULATE WORK TABLE
                //
                oDataMgr.m_strSQL = "CREATE TABLE spcgrp_dbhgrp (" +
                                    "species_group INTEGER," +
                                    "species_label TEXT," +
                                    "diam_group INTEGER," +
                                    "diam_class TEXT)";
                oDataMgr.SqlNonQuery(oDataMgr.m_Connection, oDataMgr.m_strSQL);

                foreach (ProcessorScenarioItem.SpcGroupItem objSpcGroup in ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.m_oSpcGroupItem_Collection)
                {
                    foreach (ProcessorScenarioItem.TreeDiamGroupsItem objDiamGroup in ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.m_oTreeDiamGroupsItem_Collection)
                    {
                        // INITIALIZE RECORDS IN WORK TABLE
                        oDataMgr.m_strSQL = "INSERT INTO spcgrp_dbhgrp (species_group,species_label, diam_group, diam_class) " +
                                            "VALUES (" + objSpcGroup.SpeciesGroup + ",'" + objSpcGroup.SpeciesGroupLabel + "'," +
                                            objDiamGroup.DiamGroup + ",'" + objDiamGroup.DiamClass + "')";
                        oDataMgr.SqlNonQuery(oDataMgr.m_Connection, oDataMgr.m_strSQL);
                        //
                        //INSERT SCENARIO RECORDS
                        //
                        oDataMgr.m_strSQL = "INSERT INTO scenario_tree_species_diam_dollar_values (scenario_id,species_group,diam_group) " +
                                            "VALUES ('" + ScenarioId.Trim() + "'," + objSpcGroup.SpeciesGroup + "," +
                                            objDiamGroup.DiamGroup + ")";
                        oDataMgr.SqlNonQuery(oDataMgr.m_Connection, oDataMgr.m_strSQL);
                    }
                }
            }


            //
            //UPDATE SCENARIO RECORDS WITH MERCH AND CHIP VALUES
            //
            for (x = 0; x <= this.uc_processor_scenario_spc_dbh_group_value_collection1.Count - 1; x++)
            {
                strSpcGrp     = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).SpeciesGroup.Trim();
                strDbhGrp     = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).DbhGroup.Trim();
                strWoodBin    = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).GetWoodBin();
                strMerchValue = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).CubicFootDollarValue.Trim();
                strMerchValue = strMerchValue.Replace("$", "");
                strChipValue  = this.txtChipValue.Text.Trim();
                strChipValue  = strChipValue.Replace("$", "");

                if (!ReferenceProcessorScenarioForm.m_bUsingSqlite)
                {
                    strSql = "UPDATE scenario_tree_species_diam_dollar_values a " +
                             "INNER JOIN spcgrp_dbhgrp b " +
                             "ON  a.species_group=b.species_group AND " +
                             "a.diam_group=b.diam_group " +
                             "SET a.merch_value=" + strMerchValue + "," +
                             "a.chip_value=" + strChipValue + ", " +
                             "a.wood_bin='" + strWoodBin.Trim() + "' " +
                             "WHERE TRIM(a.scenario_id)='" + ScenarioId.Trim() + "' AND " +
                             "TRIM(b.species_label)='" + strSpcGrp + "' AND " +
                             "TRIM(b.diam_class)='" + strDbhGrp + "'";
                    m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, strSql);
                }
                else
                {
                    strSql = "UPDATE scenario_tree_species_diam_dollar_values " +
                             "SET merch_value = " + strMerchValue + "," +
                             "chip_value = " + strChipValue + "," +
                             "wood_bin = '" + strWoodBin.Trim() + "' WHERE EXISTS (" +
                             "SELECT * FROM spcgrp_dbhgrp " +
                             "WHERE scenario_tree_species_diam_dollar_values.species_group = spcgrp_dbhgrp.species_group " +
                             "AND scenario_tree_species_diam_dollar_values.diam_group = spcgrp_dbhgrp.diam_group " +
                             "AND TRIM(scenario_tree_species_diam_dollar_values.scenario_id) = '" + ScenarioId.Trim() + "' " +
                             "AND TRIM(spcgrp_dbhgrp.species_label) = '" + strSpcGrp + "' " +
                             "AND TRIM(spcgrp_dbhgrp.diam_class) = '" + strDbhGrp + "')";

                    oDataMgr.SqlNonQuery(oDataMgr.m_Connection, strSql);
                }

                uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).SaveValues();
            }
            this.m_strChipValueSave = this.txtChipValue.Text;
            if (ReferenceProcessorScenarioForm.m_bUsingSqlite)
            {
                //
                //DELETE THE WORK TABLE AND CLOSE CONNECTION
                //
                if (oDataMgr.TableExist(oDataMgr.m_Connection, "spcgrp_dbhgrp"))
                {
                    oDataMgr.SqlNonQuery(oDataMgr.m_Connection, "DROP TABLE spcgrp_dbhgrp");
                }
                m_intError = oDataMgr.m_intError;

                oDataMgr.CloseConnection(oDataMgr.m_Connection);
                oDataMgr = null;
            }
        }
        public void savevalues()
        {
            int    x;
            string strSpcGrp     = "";
            string strDbhGrp     = "";
            string strMerchValue = "";
            string strChipValue  = "";
            string strWoodBin    = "";
            string strFields     = "scenario_id,species_group,diam_group,wood_bin,merch_value,chip_value";
            string strValues     = "";

            //
            //DELETE THE CURRENT SCENARIO RECORDS
            //
            m_oAdo.m_strSQL = "DELETE FROM scenario_tree_species_diam_dollar_values " +
                              "WHERE TRIM(scenario_id)='" + this.ScenarioId.Trim() + "'";
            m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
            //
            //DELETE THE WORK TABLE
            //
            if (m_oAdo.TableExist(m_oAdo.m_OleDbConnection, "spcgrp_dbhgrp"))
            {
                m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, "DROP TABLE spcgrp_dbhgrp");
            }
            //
            //CREATE AND POPULATE WORK TABLE
            //
            m_oAdo.m_strSQL = "CREATE TABLE spcgrp_dbhgrp (" +
                              "species_group INTEGER," +
                              "species_label CHAR(50)," +
                              "diam_group INTEGER," +
                              "diam_class CHAR(15))";
            m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);

            foreach (ProcessorScenarioItem.SpcGroupItem objSpcGroup in ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.m_oSpcGroupItem_Collection)
            {
                foreach (ProcessorScenarioItem.TreeDiamGroupsItem objDiamGroup in ReferenceProcessorScenarioForm.m_oProcessorScenarioItem.m_oTreeDiamGroupsItem_Collection)
                {
                    // INITIALIZE RECORDS IN WORK TABLE
                    m_oAdo.m_strSQL = "INSERT INTO spcgrp_dbhgrp (species_group,species_label, diam_group, diam_class) " +
                                      "VALUES (" + objSpcGroup.SpeciesGroup + ",'" + objSpcGroup.SpeciesGroupLabel + "'," +
                                      objDiamGroup.DiamGroup + ",'" + objDiamGroup.DiamClass + "')";
                    m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
                    //
                    //INSERT SCENARIO RECORDS
                    //
                    m_oAdo.m_strSQL = "INSERT INTO scenario_tree_species_diam_dollar_values (scenario_id,species_group,diam_group) " +
                                      "VALUES ('" + ScenarioId.Trim() + "'," + objSpcGroup.SpeciesGroup + "," +
                                      objDiamGroup.DiamGroup + ")";
                    m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
                }
            }

            //
            //UPDATE SCENARIO RECORDS WITH MERCH AND CHIP VALUES
            //
            for (x = 0; x <= this.uc_processor_scenario_spc_dbh_group_value_collection1.Count - 1; x++)
            {
                strValues     = "";
                strSpcGrp     = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).SpeciesGroup.Trim();
                strDbhGrp     = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).DbhGroup.Trim();
                strWoodBin    = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).GetWoodBin();
                strMerchValue = uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).CubicFootDollarValue.Trim();
                strMerchValue = strMerchValue.Replace("$", "");
                strChipValue  = this.txtChipValue.Text.Trim();
                strChipValue  = strChipValue.Replace("$", "");

                m_oAdo.m_strSQL = "UPDATE scenario_tree_species_diam_dollar_values a " +
                                  "INNER JOIN spcgrp_dbhgrp b " +
                                  "ON  a.species_group=b.species_group AND " +
                                  "a.diam_group=b.diam_group " +
                                  "SET a.merch_value=" + strMerchValue + "," +
                                  "a.chip_value=" + strChipValue + ", " +
                                  "a.wood_bin='" + strWoodBin.Trim() + "' " +
                                  "WHERE TRIM(a.scenario_id)='" + ScenarioId.Trim() + "' AND " +
                                  "TRIM(b.species_label)='" + strSpcGrp + "' AND " +
                                  "TRIM(b.diam_class)='" + strDbhGrp + "'";


                m_oAdo.SqlNonQuery(m_oAdo.m_OleDbConnection, m_oAdo.m_strSQL);
                uc_processor_scenario_spc_dbh_group_value_collection1.Item(x).SaveValues();
            }
            this.m_strChipValueSave = this.txtChipValue.Text;
        }