PowerBuilder Interview Question and Answers

36. 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
 
Your Name Your Email-ID
Your Answer
37. What is the method to validate a numeric column in a DataWindow?
  SetValidate()
 
Your Name Your Email-ID
Your Answer
38. In what attribute of the Transaction object are the database-specific error codes for Connect/Update/Retrieve stored?
  SQLDBCode
 
Your Name Your Email-ID
Your Answer
39. 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’”)
 
Your Name Your Email-ID
Your Answer
40. What is an Update flag?
  We use them when we need to update multiple DataBase tables from one DataWindow.
 
Your Name Your Email-ID
Your Answer