private void OnSelectColumnsCommandGetColumns(object state) { TableNode node = (TableNode)state; ColumnSchemaCollection columns = node.Table.Columns; //this can invoke the schema provider, so it must be in bg thread DispatchService.GuiDispatch(delegate() { SelectColumnDialog dlg = new SelectColumnDialog(true, columns); if (dlg.Run() == (int)Gtk.ResponseType.Ok) { IdentifierExpression tableId = new IdentifierExpression(node.Table.Name); List <IdentifierExpression> cols = new List <IdentifierExpression> (); foreach (ColumnSchema schema in dlg.CheckedColumns) { cols.Add(new IdentifierExpression(schema.Name)); } SelectStatement sel = new SelectStatement(new FromTableClause(tableId), cols); IPooledDbConnection conn = node.ConnectionContext.ConnectionPool.Request(); IDbCommand command = conn.CreateCommand(sel); conn.ExecuteTableAsync(command, new ExecuteCallback <DataTable> (OnSelectCommandThreaded), null); } dlg.Destroy(); }); }
protected void OnSelectAllCommand() { TableNode node = (TableNode)CurrentNode.DataItem; IdentifierExpression tableId = new IdentifierExpression(node.Table.Name); SelectStatement sel = new SelectStatement(new FromTableClause(tableId)); IPooledDbConnection conn = node.ConnectionContext.ConnectionPool.Request(); IDbCommand command = conn.CreateCommand(sel); conn.ExecuteTableAsync(command, new ExecuteCallback <DataTable> (OnSelectCommandThreaded), null); }