Beispiel #1
0
        //Insert All-Transactions House Price Index for Arizona
        public void InsertAZSTHPI(System.Web.UI.WebControls.ListBox ListBox1)
        {
            string a, b, c, d, e, f, g, h, i;

            FRED m = new FRED();

            a = m.getDate(); // date

            b = "Arizona"; // stateName

            c = m.AZSTHPI(); // all-transactions HPI

            d = "NULL"; // 20rsa

            e = "NULL"; // 20rnsa

            f = "NULL"; // 20rpsnsa

            g = "NULL"; // 10rsa

            h = "NULL"; // 10rnsa

            i = "NULL"; // 10rpsnsa

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

            else
            {
                try
                {
                    String query = String.Format("INSERT INTO state_stats VALUES('{0}', '{1}', '{2}', {3}, {4}, {5}, {6}, {7}, {8})", a, b, c, d, e, f, g, h, i);

                    //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 AZSTHPI. \n", a);
                }
                catch { UpdateAZSTHPI(c, a, ListBox1); }
            }
        }