Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
AV's and Parameters not found...
#2
I am a bit closer to finding the reason, I hope. Tests today gives ADOStoredProc error: Cannot persorm this operation on a closed dataset.

However, the dataset is not closed at the time of the call. I always use a structure like this:

dm := TApp3TDB.Create(nil);
try
dm.ADOSP1.ProcedureName := 'sp_CustomerGet';
dm.ADOSP1.Parameters.Refresh;
dm.ADOSP1.Parameters.ParamByName('@CustomerNo').value := CustomerNo;
dm.ADOSP1.Prepared := true;
try
dm.ADOSP1.open;
if dm.ADOSP1.RecordCount > 0 then
begin
CustomerName := dm.ADOSP1.FieldByName('CustomerName').AsString;
end;
except
on e:exception do LogError('Error: '+e.Message);
end;
finally
dm.Free;
end;

So I do open it (or when calling a sp with and update/insert or Delete statement, I use ADOSP1.ExceSql).

What I do not do, is close it, so the error should be Dataset NOT closed rather than Dataset closed. As the procedure exits after, I expect ADOSP1 will be closed without specifically having the code to call adosp1.close;

If could be the properties of the ADOSP1, I need to set differently, but I do not know enough about which or why, so if anybody knows abut these, please feel free to comment.

Regards
Soren

NB! I do still think it is a question of sharing conflicts, like in a non thread safe code.
Reply


Messages In This Thread
AV's and Parameters not found... - by SorenJensen - 03-02-2020, 12:14 PM
RE: AV's and Parameters not found... - by SorenJensen - 03-03-2020, 09:12 AM
RE: AV's and Parameters not found... - by kudzu - 03-03-2020, 07:33 PM

Forum Jump:


Users browsing this thread: 1 Guest(s)