Insert record using TADOQuery
Posted on 2007-11-21
I am having a problem inserting a record using TADOQuery in Delphi 5. The query is open and active (the associated datasource state is in dsBrowse) when I try to perform the insert:
with DM.CustPartQuery do begin
FieldByName('PKEY').AsString := IntToStr(nNextPKey);
FieldByName('MCI_NBR').AsString := IntToStr(nNextMCINbr);
FieldByName('FILM_STATUS').AsString := 'Active';
FieldByName('SUBCONTRACTED').AsBoolean := (Response=mrYes);
During debug I can see that after the insert statement, the datasource is still in dsBrowse mode. Then when it tries to assign the first field, I get an error "Dataset not in insert or edit mode"
What am I doing wrong?