Beispiel #1
0
        //Insert MARICOPA COUNTY population_NSA statement
        public void InsertMariPOP(System.Web.UI.WebControls.ListBox ListBox1)
        {
            string a, b, c, d, e, f;

            FRED m = new FRED();

            a = m.getDate(); // date

            b = "Maricopa"; //countyName

            c = "Arizona"; // stateName

            d = "NULL"; // unemployment_NSA

            e = m.AZMARIPOP(); // population_NSA

            f = "NULL"; // labor_force_NSA

            if (e == "DNF")
            {
                ListBox1.Text += "mariPOP up to date! \n";
            }

            else
            {
                try
                {
                    String query = String.Format("INSERT INTO county_stats VALUES('{0}', '{1}', '{2}', {3}, '{4}', {5})", a, b, c, d, e, f);

                    //create command and assign the query and connection from the constructor
                    MySqlCommand cmd = new MySqlCommand(query, connection);

                    //Execute command
                    cmd.ExecuteNonQuery();

                    ListBox1.Text += String.Format("{0} has been updated with MariPOP. \n", a);
                }
                catch { UpdateMariPOP(e, a, ListBox1); }
            }
        }