Shoki
Shoki

Reputation: 21

Why datawindow query does not refresh column specifications?

The Query behind datawindow is Select * from MyTable. I changed the table and added another column. When i retrieve the datawindow in design mode, it does not show me the new column i added in MyTable

I assume that Select * from MyTable will not require editing datawindow in design mode and every change in database table will update the datawindow design as well.

How do i get all the columns in column specifications without changing datawindow in design mode to manually add the column in detail area of the datawindow?

PowerBuilder 12.5 / MSSQL Server 2008

Upvotes: 0

Views: 1014

Answers (2)

Matt Balent
Matt Balent

Reputation: 2397

I assume that Select * from MyTable will not require editing datawindow in design mode and every change in database table will update the datawindow design as well.

This is not a valid assumption. If you change the underlying table columns either by adding, removing, or datatypes, you have to bring any datawindow objects which reference that table (by reference I mean you want to use the new column or had used an old column or one with the changed datatype) back into the editor to have them reflected in that dwo.

Another option is to edit the source of the datawindow object but this would only be for trivial updates (like you expanded a varchar field from 10 to 20).

Upvotes: 0

Marc Vanhoomissen
Marc Vanhoomissen

Reputation: 395

If you want to do this, you can use the create method of your datawindow control:

String new_sql, new_syntax, errorsyntaxfromSQL, errorcreate

new_sql = 'SELECT * from Mytable'
new_syntax = SQLCA.SyntaxFromSQL(new_sql, 'Style(Type=Form)', error_syntaxfromSQL)
// Generate new DataWindow
dw_new.Create(new_syntax, error_create)

It is up to you to test the possible errors.

Upvotes: 1

Related Questions