procedure Tfrmorder.BitBtn4Click(Sender: TObject); //保存数据
begin
adoquery1.FieldByName('状态').Value:='未完成';
if (adoquery1.state<>dsEdit)or(adoquery1.state<>dsInsert) then //一按保存,这里出错
adoquery1.UpdateBatch();
end;以下是出错的信息:
---------------------------
Debugger Exception Notification
---------------------------
Project Project.exe raised exception class EDatabaseError with message 'ADOQuery1: Dataset not in edit or insert mode'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
begin
adoquery1.FieldByName('状态').Value:='未完成';
if (adoquery1.state<>dsEdit)or(adoquery1.state<>dsInsert) then //一按保存,这里出错
adoquery1.UpdateBatch();
end;以下是出错的信息:
---------------------------
Debugger Exception Notification
---------------------------
Project Project.exe raised exception class EDatabaseError with message 'ADOQuery1: Dataset not in edit or insert mode'. Process stopped. Use Step or Run to continue.
---------------------------
OK Help
---------------------------
begin
adoquery1.FieldByName('状态').Value:='未完成';
if (adoquery1.state=dsEdit)or(adoquery1.state=dsInsert) then //一按保存,这里出错
adoquery1.UpdateBatch();
end;一样出错
TDataSetState = (dsInactive, dsBrowse, dsEdit, dsInsert, dsSetKey,
dsCalcFields, dsFilter, dsNewValue, dsOldValue, dsCurValue, dsBlockRead,
dsInternalCalc, dsOpening);
begin
if (adoquery1.state=dsEdit)or(adoquery1.state=dsInsert) then
begin
adoquery1.FieldByName('状态').Value:='未完成';
adoquery1.UpdateBatch();
end;
end;这样就没错了,谢谢各位