문제

In my form I have TADOQuery,TDataSetProvider,TClientDataSet,TDataSource,TDBGrid linked.

AdoQuery use SQL Server view to query data

AdoQuery.SQL:

Select * from vu_Name where fld=:fldval

Vu_Name:

SELECT * FROM  t1 INNER JOIN t2 ON t2.fld1 = t2.fld1

in my dbgrid, only columns in table t1 are editable.(only t1 need to update )

What are the possible (fastest) ways to apply updates back to the server? ClientDataSet.ApplyUpdates(0); // not working

Thank you.

도움이 되었습니까?

해결책

TDataSetProvider has an event OnGetTableName where you should set the TableName parameter to t1. Thus the provider knows where to store the changed values.

You have to make sure that only fields of t1 are changed as TDataSetProvider will only update one table. Of course you can have different table names for different calls to ApplyUpdates. You can find out about changed fields in the DataSet parameter.

If you want to update more than one table you have to implement OnUpdateData, which gives you all of the freedom with all of the responsibility.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top