PgSqlDataTable.RefreshingFields not working for me.

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for PostgreSQL
Post Reply
onish
Posts: 13
Joined: Mon 03 May 2010 11:32

PgSqlDataTable.RefreshingFields not working for me.

Post by onish » Mon 03 May 2010 11:39

Hi,

I have a auto generated(serial) datafield in a table, whose value I want to fetch back to front end, in the datatable. I have configured the RefreshingFields and RefreshMode properties for the PgSqlDataTable. On calling the Update method, everything works fine, i.e. the record gets inserted successfully but I am not able to fetch back the new, auto-generated value back.

I am currently using the evaluation copy of the provider and we(my company) is willing to purchase this provider on my recommendation, once we evaluate the required features.

Thanks, and waiting for your reply.

onish
Posts: 13
Joined: Mon 03 May 2010 11:32

Post by onish » Mon 03 May 2010 12:07

Hi,

My problem was solved by using the RETURNING keyword at the end of the InsertStatement.

Please let me know if you have any more suggestions.

Great provider :)

Thanks.

onish
Posts: 13
Joined: Mon 03 May 2010 11:32

Post by onish » Mon 03 May 2010 12:48

I am now facing another issue and need help:

Consider the two tables, namely Categories and Sub-Categories, they are linked to each other by CategoryID. Now both the tables have auto generated columns(serial), for Categories it is CategoryID and for Sub-Categories it is Sub-CategoryID. I have configured a PgSqlDataSet which contains two PgSqlDataTable. The DataSet also contains a relationship between this two tables on CategoryID, named Relation1.

Now I want to forward the auto-generated and fetched value for CaregoryID of Categories table to the Child Rows, the rows which belongs to Sub-Categories table. How can I achieve this?

Waiting for your reply, Thanks.

StanislavK
Devart Team
Posts: 1710
Joined: Thu 03 Dec 2009 10:48

Post by StanislavK » Thu 06 May 2010 15:19

As I can understand, you need to
1) retrieve the generated CategoryID field of the newly inserted row in Categories;
2) update the rows in Sub-Categories setting their CategoryID fields to CategoryID from the first point.

The first point can be done using the RefreshingFields and RefreshMode properties, to perform the second one you need to execute UpdateCommand of corresponding PgSqlDataTable.

Please tell us if you are encountering any problems with this.

Post Reply