PowerBuilder Interview Question and Answers:
36. How can you change a Select statement of the DataWindow at runtime?We can change the select statement by using functions SetSQLSelect() or by changing the data attributes Table.Select by calling function Modify().
Modify() is preferable because it works faster.
dw_1.Modify(“datawindow.Table.Select = ‘Select * from customer’”)
37. What is an Update flag?
We use them when we need to update multiple DataBase tables from one DataWindow.
38. How can you update multiple DataBase tables from one DataWindow?
Using Modify() function. When a DataWindow is based on a join of multiple tables, we can update all of those tables by modifying attributes DataWindow.Table, UpdateTable and column attributes Update and Key using Modify() function. For example, if the data initially came from DEPARTMENT and EMPLOYEE tables, and DEPARTMENT table was specified as an Update Table when we painted the DataWindow, we need to:
1. Update the DEPARTMENT table using the Update() function:
iRet = dw_1.Update (TRUE (AcceptText(), FALSE (ResetBuffer))
2.Modify the Update characteristics of the DataWindow to point to the Employee table:
IF iRet = 1 THEN
dw_1.Modify(“Dep_id.Update = NO”) dw_1.Modify(“Dep_name.Update = NO”)
dw_1.Modify(“Dep_id.Key = NO”)
dw_1.Modify(“DataWindow.Table.Updatetable = ‘employee’”)
dw_1.Modify(“Dep_id.Update = YES”)
dw_1.Modify(“Dep_name.Update = YES”)
dw_1.Modify(“Dep_id.Key = YES”)
dw_1.Update()
END IF
39. What is the method to validate a numeric column in a DataWindow?
SetValidate()
40. In what attribute of the Transaction object are the database-specific error codes for Connect/Update/Retrieve stored?
SQLDBCode
No comments:
Post a Comment