Daniel Rogers
Daniel Rogers

Reputation: 39

FireDac TFDScript.ExecScript() not working

I have a TFDScript component loaded with 2 scripts.

In my code I am trying to execute a selected script using

TFDScript1.ExecuteScript('InsertScript');

but I get this error

[DCC Error] StartTask.pas(77): There is no overloaded version of 'ExecuteScript' that can be called with these arguments

Upvotes: 0

Views: 1903

Answers (1)

Jerry Dodge
Jerry Dodge

Reputation: 27276

Looking at the documentation, you're expected to pass in a TStrings instance, however you're trying to pass in just a String. You need to create a TStringList instance and pass it as the parameter instead. The particular error your are receiving indicates that you are passing parameters which differ from the parameters which are expected.

var
  Script: TStringList;
begin
  Script:= TStringList.Create;
  try
    Script.Text:= 'Some SQL Script';
    FDScript1.ExecuteScript(Script);
  finally
    Script.Free;
  end;
end;

If you already have script loaded, then call ExecuteAll instead.

If, for some reason, you wish to execute only one script at a time, then create multiple TFDScript instances. This component doesn't appear to be designed to run only one of the multiple scripts at a time.

Upvotes: 2

Related Questions