"Record not found or changed by another user"错误!
用的TSimpleDataSet控件,在
sdtShowLst.Post();
sdtShowLst.ApplyUpdates(0);
后出现上述错误(在执行第二次时出问题)!下面是Before Post中的内容
procedure TfrmMain.sdtShowLstBeforePost(DataSet: TDataSet);
begin
if FCurShowType = lstBitmap then
begin
dbeShowText.Text := '';
DataSet.FieldByName('ShowText').AsString := ''; //1
end else
(DataSet.FieldByName('BMP') as TBLOBFIELD).Assign(nil); DataSet.FieldByName('CODE').Assign(sdtMaster.FieldByName('CODE'));
end;====奇怪的是,当1处的代码换成=====
DataSet.FieldByName('ShowText').Assign(nil);时没有问题换成DataSet.FieldByName('ShowText').Value := '';也同样出问题但上述代码在其他地方(如TDBLookupComboBox的OnCloseUp中)则不出问题??????
用的TSimpleDataSet控件,在
sdtShowLst.Post();
sdtShowLst.ApplyUpdates(0);
后出现上述错误(在执行第二次时出问题)!下面是Before Post中的内容
procedure TfrmMain.sdtShowLstBeforePost(DataSet: TDataSet);
begin
if FCurShowType = lstBitmap then
begin
dbeShowText.Text := '';
DataSet.FieldByName('ShowText').AsString := ''; //1
end else
(DataSet.FieldByName('BMP') as TBLOBFIELD).Assign(nil); DataSet.FieldByName('CODE').Assign(sdtMaster.FieldByName('CODE'));
end;====奇怪的是,当1处的代码换成=====
DataSet.FieldByName('ShowText').Assign(nil);时没有问题换成DataSet.FieldByName('ShowText').Value := '';也同样出问题但上述代码在其他地方(如TDBLookupComboBox的OnCloseUp中)则不出问题??????
数据表:TTable, TQuery的 UpdateMode默认 upWhereAll。改成 upWhereKeyOnly,并在FieldList中设上关键字 (字段的 ProviderFlag.pfInKey:=true)。