PowerBuilder Create Dynamically A DataWindow/Datastore From SQL And Transaction
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 | datastore lds_data String ls_select String ls_where String ls_dwsyntax String ls_err // sql query data from database ls_select = "Select id, fname, lname, address, city, state, zip from customer where customer.fname like '" + is_cust + "%'" // create syntaxfromsql ls_dwsyntax = SQLCA.SyntaxFromSQL ( ls_select, "Style(Type=grid)", ls_err ) //create datawindow from syntax dw_1.Create ( ls_dwsyntax, ls_err ) If ls_err <> '' Then MessageBox ( "error - Syntax", ls_err ) Else dw_1.SetTransObject ( SQLCA ) dw_1.Retrieve() End If //create datastore from syntax lds_data = Create datastore lds_data.Create(SQLCA.SyntaxFromSQL(ls_dwsyntax , 'Style(Type=Form)', ls_err)) If ls_err <> '' Then MessageBox ( "error - Syntax", ls_err ) Else lds_data.SetTransObject ( SQLCA ) lds_data.Retrieve() End If |
Good Luck!