сохраняю данные в БД на dataset.BeforePost
[code]
// начинаем транзакцию
DbMs.TransactionStart;
try
// модифицируем данные
with
DbMs.StoredProcExecute
(
'dbo.spDocumentsItemsModify',
[
DbMsParameter('DocumentId', HeaderQuery['DocumentId']),
DbMsParameter('Data', TMsQuery(DataSet).RecordToXml)
]
)
do
begin
// обновляем данные
with TMsQuery(DataSet) do
begin
FieldValues['ItemId'] := StoredProc['ItemId'];
RefreshRecord;
end;
end;
// обновляем заголовок
HeaderQuery.RefreshRecord;
// фиксируем транзакцию
DbMs.TransactionCommint;
except
// откатываем транзакцию
DbMs.TransactionRollback;
// откатываем изменения
DataSet.Cancel;
raise;
end;
[/code]
если вызывать RefreshRecord то в наборе данных появляется дубликат записи а не обновляется текущая, что я делаю не так ?
sdac 5.0
RefreshRecord & DataSet.BeforePost
-
AndreyZ
Hello,
Usage of the RefreshRecord method in the BeforePost event is not allowed, because all changes in DataSet will be canceled. The RefreshRecord method performs a query to the database and refetches new field values from the returned cursor. This means that your changes will be replaced by values from the database.
Please, in future, write in English.
Usage of the RefreshRecord method in the BeforePost event is not allowed, because all changes in DataSet will be canceled. The RefreshRecord method performs a query to the database and refetches new field values from the returned cursor. This means that your changes will be replaced by values from the database.
Please, in future, write in English.