private void button1_Click(object sender, EventArgs e) { if (conn == null) { try { conn = ConnectionPool.GetConnection(); } catch (Exception ex) { errorLabel.Text = ex.Message; } } object result = (object)conn.k("select from trade"); c.Flip table = (c.Flip)result; QueryView.Columns.Clear();//Clear columns first to allow clean population of table foreach (string colName in table.getColumns()) { QueryView.Columns.Add(colName, colName); //Add the columns to the Queryview } QueryView.Rows.Add(table.getNoRow()); for (int row = 0; row < table.getNoRow(); row++) { for (int col = 0; col < (table.getColumns().Length); col++) { QueryView[col, row].Value = c.at(table.y[col], row); //Populate each cell of the Queryview with its associated value } } ConnectionPool.ReturnConnection(conn); }
private void button1_Click(object sender, EventArgs e) { try { if (conn == null) { conn = ConnectionPool.GetConnection(); } String query = BuildQuery(); try { object result = null; result = (object)conn.k(query); c.Flip table = (c.Flip)result; QueryView.Columns.Clear(); foreach (string colName in table.getColumns()) { QueryView.Columns.Add(colName, colName); } QueryView.Rows.Add(table.getNoRow()); for (int row = 0; row < table.getNoRow(); row++) { for (int col = 0; col < (table.getColumns().Length); col++) { QueryView[col, row].Value = c.at(table.y[col], row); } } errorLabel.Text = ""; QueryView.CellClick += (QueryView_CellClick); } catch (Exception ex) { errorLabel.Text = "ERROR:" + ex.Message; } ConnectionPool.ReturnConnection(conn); } catch (Exception ex) { errorLabel.Text = "Unexpected error: " + ex.Message; } }
private void PopulateGrid(c.Flip table) { resultsGridView.Columns.Clear(); foreach (string colName in table.getColumns()) { resultsGridView.Columns.Add(colName, colName); } resultsGridView.Rows.Add(table.getNoRow()); for (int row = 0; row < table.getNoRow(); row++) { for (int col = 0; col < (table.getColumns().Length); col++) { resultsGridView[col, row].Value = c.at(table.y[col], row); } } }