Пример #1
0
        public List<BarChart> getBarChart(string tid)
        {
            List<BarChart> bclist = new List<BarChart>();
            using (MySqlConnection cn = new MySqlConnection())
            {
                using (MySqlCommand cmd = new MySqlCommand())
                {
                    // obtain connection string information from app.config
                    cn.ConnectionString = "server=localhost; userid=root; password=; database=twitter_stream;";
                    // tell the cmd to use the cn
                    cmd.Connection = cn;
                    // supply the cmd with the necessary SQL Y-M-D FULL
                    cmd.CommandText = "SELECT * FROM contentsretrievedtemp WHERE tagId = '" + tid + "'";
                    //testing/print out sqlquery
                    System.Diagnostics.Debug.WriteLine(cmd.CommandText);
                    cn.Open();
                    // returns the results
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            BarChart bc = new BarChart(reader.GetString("mood"), reader.GetString("content"));
                            bclist.Add(bc);
                        }
                    }

                }
            }
            return bclist;
        }
Пример #2
0
 public static object getBarChart(string tagd)
 {
     List<BarChart> bclist = new List<BarChart>();
     BarChart bc = new BarChart();
     bclist = bc.getBarChart(tagd);
     object response = bclist;
     return response;
 }