Refresh DataTable in TableAdapter

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
Posts: 7
Joined: Thu 09 Oct 2008 00:54

Refresh DataTable in TableAdapter

Post by jorgesv13 » Thu 09 Oct 2008 20:26


I am working now on migrating an application that was in SQLServer to PostgreSQL, so I'm using PostgreSQLDirect to make the migration as smooth as possible.

However, I have a problem when working with DataSets and TableAdapters.
In PostgreSQL Table Adapters, the option "Refresh the Data Table" is disabled, and I was using this option for automatically retrieve the Inserted ID of an autoincremental column.
Is there a way to turn ON the Refreshing, so I can get the new values?

Site Admin
Posts: 8247
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 14 Oct 2008 13:29

Right click on PgSqlDataAdapter | Configure Data Adapter. Set Connection Component (when you try to call the Preview Data window, the component proposes you to set connection parameters). Go to the Command Generator tab, click the Get Table Fields button, check the Refreshing property for necessary column. Also you need to set two "With refresh SQL" properties from the Options section (for insert and for update commands). Don't forget to uncheck the Updating property for your autoincrement column. After that click "Generate Commands". Go to the Preview Data window and make sure after clicking the Update button the ID values are fetched from database.

There are also the RefreshMode and RefreshingFields properties in PgSqlCommandBuilder.

If you have any further questions, feel free to contact us.

Post Reply