Example #1
0
 public DlgSupcomStats()
 {
     DataRow current;
     this.components = null;
     this.mConnection = new OdbcConnection("DSN=gpgstats;");
     this.InitializeComponent();
     this.mConnection.Open();
     OdbcDataReader reader = new OdbcCommand("SELECT * FROM units_player", this.mConnection).ExecuteReader();
     DataTable table = new DataTable();
     using (IEnumerator<object> enumerator = (IEnumerator<object>)reader.GetSchemaTable().Rows.GetEnumerator())
     {
         while (enumerator.MoveNext())
         {
             current = (DataRow) enumerator.Current;
             table.Columns.Add(current[0].ToString(), (System.Type) current[5]);
         }
     }
     while (reader.Read())
     {
         current = table.NewRow();
         for (int i = 0; i < reader.FieldCount; i++)
         {
             current[i] = reader[i];
         }
         table.Rows.Add(current);
     }
     reader.Close();
     this.mConnection.Close();
     this.pivotGridControl1.DataSource = table;
 }