Reputation: 2152
I'm trying to call a stored procedure from some delphi code
I have a function like
procedure TDatabaseConnection.GetHourlyFiltergramLabSamples(StartTime, EndTime : TDateTime; Samples : TList<THourlyFilterCount>);
var
StoredProc : TADOStoredProc;
begin
StoredProc := TADOStoredProc.Create(nil);
try
StoredProc.Connection := Connection;
StoredProc.ProcedureName := 'GetHourlyFiltergramLabSamples';
StoredProc.Parameters.Refresh;
StoredProc.Parameters.ParamByName('@StartTime').Value := startTime;
StoredProc.Parameters.ParamByName('@EndTime').Value := EndTime;
StoredProc.Open;
while not StoredProc.Eof do
begin
//Do stuff with the results here ...
StoredProc.Next;
end;
finally
FreeAndNil(StoredProc);
end;
end;
When I hit the line StoredProc.Open;
I get an error
'CommandText does not return a result set.'
I have checked using SQL server management studio that the stored procedure does in fact return results.
I've found that this issues seems to be temperamental. Surely this isn't a bug in the database connector??
I'm out of ideas
Upvotes: 2
Views: 11253
Reputation: 2152
I've had this one open for a number of months now.
The best solution I have is to switch to using FireDAC. I have not had the same issues when using FireDAC to execute stored procedures.
instead I use the TFDStoredProc
type to run stored procedures
Upvotes: 1