1
votes

I am trying to insert a new record but sometimes datawindow not includes all the column .

All columns are selected in the update properties but i am not getting all the columns in the insert statement.

2
Do you get an error message, or do some columns are just missing? - Seki
I am getting database error. when i checked the insert statement i found columns are missing.Even the table primary key.It does not happen always but some times it happens. - user1788373
Could you give some details, like the PB version, the dbms used and a copy of the error message? For now we must use the cristal ball to make some conjectures. - Seki
You mentioned the primary key was missing -- is it an identify column, and if so did you set the identity column in the data window object? According to Sybase documentation all columns are included in the insert, except identity and timestamp (for MS SQL Server) -- see: infocenter.sybase.com/help/index.jsp?topic=/… - Rich Bianco
powerbuilder v12 and oracle 11 . - user1788373

2 Answers

1
votes

The DataWindow isn't going to always include all columns in an INSERT statement that it generates. A column's inclusion on a given row is going to depend on that item's status that the DataWindow maintains. If the DataWindow sees that column as DataModified!, the column will be included in the INSERT. This way, it's not generating and sending unnecessary SQL.

The natural ways that a column's status will be set to DataModified! include data entry by the user, and if the column has an Initial value set in the DataWindow and another column has been data entered. (i.e. columns with Initial values are automatically set to DataModified!, but only after another column has been set to DataModified!). The synthetic way you can set a column to DataModified! is programmatically with the SetItemStatus() function. (Just be warned that I've often see people try to use this function, and they end up with unintended consequences; you need to carefully think through all the possibilities when using this function and test thoroughly.)

If there are still unexplained holes in your application's behaviour, I'd set a breakpoint in the SQLPreview event of the DataWindow and explore the columns' values, original value and item statuses. Looking at these three values will pretty much always explain the generated SQL. Explaining how these values got to their current state... often requires more digging.

Good luck,

Terry.

0
votes

Are you perhaps not calling accepttext() before the update?