1

I need to create a means of viewing and editing a postgresql table through C# WPF style app. Is it possible to do this in a DataGrid control? So far I found a class in the .NET framework called SqlDataAdapter, which can return a query result in a DataSet object, and update the data in db appropriately if the DataSet is altered. But I think this is only for Microsoft Sequel Server. Would this work for PostgreSql? And would it be possible to bind the DataSet to a Datagrid?

Thanks, Alex

Alex
  • 712
  • 2
  • 13
  • 27

1 Answers1

2

npgsql is what I have always used. It uses the same interfaces so instead of a SqlDataAdapter you'll have an NpgsqlDataAdapter that functions the same way. From there, you can populate your DataTable or DataSource and bind that to your DataGrid.

swasheck
  • 4,644
  • 2
  • 29
  • 56
  • Thanks, I have been using Npgsql and did not think to look there. Can the DataTable and DataSource objects be bound to a DataGrid in WPF? I found examples of this, but they were for System.Windows.Forms based controls. – Alex Aug 31 '12 at 15:56
  • 2
    [link 1](http://stackoverflow.com/questions/2677446/binding-wpf-datagrid-to-datatable-using-templatecolumns) [link 2](http://stackoverflow.com/questions/2511177/how-to-bind-a-table-in-a-dataset-to-a-wpf-datagrid-in-c-sharp-and-xaml) – swasheck Aug 31 '12 at 16:06