Search code examples
selectdynamicpowerbuilder

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


Solution

  • 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.