Home > database >  The Data window does not have the update capability
The Data window does not have the update capability

Time:09-22

To update the SQL Data window is associated with multiple tables, the useful SETSQLSELECT () function), I do ll_rtn=dw_1. Update (true, false) tip Data window does not have the update capability, I how to do, please god help solve

CodePudding user response:

 
More data window table update
Principle:
Data window data from two or more than two tables, equivalent to more than one table of a view of the connection is established, for the data window, PB is cannot be modified by default, of course, we can set the Update Properties, data window Update Properties whether can be used to set the data window Update, Update table, can Update column, etc., but it can't set up two tables can be updated at the same time; So when modify its data items, we cannot simply use dw_1, update () to update the table, we can set the data window can be updated in the application of A table A (and its renewable column), other tables to be updated, after updating the table A, set up another table B as renewable, exhibit A is set to not update and so on,

Solution example:
We PowerBuilder7 bring ASA6 database, for example:
1, create a new data window d_grid_dep_emp, which Select statement for
SELECT department. Dept_id,
Department. Dept_name,
The employee emp_id,
The employee emp_fname,
The employee. Emp_lname
FROM the department, the employee
Where the employee. Dept_id=department. Dept_id

2, set data window d_grid_dep_emp properties, the column taborder instead of non-zero value; Rows and click menu - & gt; Update Properties, set the data window Allow Updates to the Table to Update to department, for Updateable Columns for the department. The dept_id, department. Dept_name,

3, update the data in the window the window button clicked event script:
Long ll_rtn
//modify the Department table, Department table in step 2 is set to update)
Ll_rtn=dw_1. Update (true, false)

If ll_rtn=1 then
//close to modify the Department table
Dw_1. Modify (" department_dept_name. Update='No' ")
Dw_1. Modify (" department_dept_id. Update='No' ")
Dw_1. Modify (" department_dept_id. Key='No' ")

//set the Employee table become the new can modify the table
Dw_1. Modify (" DataWindow. Table. UpdateTable='employee' ")
Dw_1. Modify (" employee_emp_id. Update='Yes' ")
Dw_1. Modify (" employee_emp_fname. Update='Yes' ")
Dw_1. Modify (" employee_emp_lname. Update='Yes' ")
Dw_1. Modify (" employee_emp_id. Key='Yes' ")

//modify the Employee table
Ll_rtn=dw_1. The Update ()
IF ll_rtn=1 THEN
COMMIT the USING the SQLCA;
Dw_1. Retrieve ()
Messagebox (' message 'and' updated successfully! ')
The ELSE
The ROLLBACK USING SQLCA;
MessageBox (' message 'and' update failed! ')
END the IF

//reset mark
Dw_1. Modify (" department_dept_name. Update='Yes' ")
Dw_1. Modify (" department_dept_id. Update='Yes' ")
Dw_1. Modify (" department_dept_id. Key='Yes' ")
Dw_1. Modify (" DataWindow. Table. UpdateTable='department' ")
Dw_1. Modify (" employee_emp_id. Update='No' ")
Dw_1. Modify (" employee_emp_fname. Update='No' ")
Dw_1. Modify (" employee_emp_lname. Update='No' ")
Dw_1. Modify (" employee_emp_id. Key='No' ")
The ELSE
The ROLLBACK USING SQLCA;
MessageBox (' message 'and' update failed! ')
END the IF
This completes the update of two tables, of course, we can put the above function into a function, called when required,

CodePudding user response:

refer to the original poster twc1982 response:
to update the SQL Data window is associated with multiple tables, the useful SETSQLSELECT () function), I do ll_rtn=dw_1. Update (true, false) tip Data window does not have the update capability, I how to do, please god help solve

This I tested many times, many tables, using setsqlselect datawindow is lost updateable properties, no way,
With the object. The datawindow. Select="select... The from... "
As can be, it is two years ago, has been measured can not remember clearly chu

CodePudding user response:

Dw_1. Modify (" DataWindow. Table. Select='" + SQL statement + "' ")

CodePudding user response:

The novice consult
Teachers, in SQL 2008 R2 tip Data window does not have the update capability how to solve this problem??
Please give guidance

CodePudding user response:

The row - & gt; Update the properties - & gt; Choose to update the table

CodePudding user response:

The row - & gt; Update the properties - & gt; Choose to update the table
  • Related