1. Deva Shanmuga
  2. PowerBuilder
  3. Monday, 15 July 2024 09:25 AM UTC

Hello Experts,

In a datastore, I am inserting a row and placing values for all columns except for the Roll_no column, which is an auto-increment field. I saved the datastore. Now I need to retrieve the value for the column Roll_no. How can I achieve this?

Thanks

Deva S

 

Accepted Answer
René Ullrich Accepted Answer Pending Moderation
  1. Tuesday, 16 July 2024 07:13 AM UTC
  2. PowerBuilder
  3. # Permalink
For MS SQL Server you can specify in the connection settings how PB gets the identity column value: https://docs.appeon.com/pb2022r3/connection_reference/Identity.html You have also to specify the identity column in DW update properties.
Comment
There are no comments made yet.
Chris Pollach @Appeon Accepted Answer Pending Moderation
  1. Monday, 15 July 2024 13:33 PM UTC
  2. PowerBuilder
  3. # 1

Hi Deva;

  If you are truely using an Identity (autoincrement) column in SS, then the new value will be in the DWO after the insert as the DWIO is preprogrammed to automatically retrieve the new value after the insert operation completes. If it does not, then the problem is your DB Schema design. You should check this with your DBA team as the DWO has been doing this since PB 2-3 against Sybase SS & now MS SS 

  Manually though, you can ask your DWO to refresh it's buffer after an Update() by using the ReSelectRow() command.  HTH 

Regards ... Chris 

Comment
There are no comments made yet.
René Ullrich Accepted Answer Pending Moderation
  1. Monday, 15 July 2024 10:00 AM UTC
  2. PowerBuilder
  3. # 2

What database do you use? For some databases PB supports identity columns. For identity columns PB gets the values automatically.

Comment
  1. Deva Shanmuga
  2. Monday, 15 July 2024 10:04 AM UTC
Hello Rene Ullrich,

I am using MS SQL Server as database.
  1. Helpful
  1. Sivaprakash BKR
  2. Monday, 15 July 2024 11:45 AM UTC
From my memory,

1. select the identity column in the datawindow update properties

2. After dw_1.update and before dw_1.reset, read the identity column, via dw_1.GetItemNumber command. You can get that value. I remember getting those values like this earlier.

  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.
We use cookies which are necessary for the proper functioning of our websites. We also use cookies to analyze our traffic, improve your experience and provide social media features. If you continue to use this site, you consent to our use of cookies.