if InParamCount <= ParamIndex then
raise EZSQLException.Create(SInvalidInputParameterCount);
InParamCount is equals to ParamIndex. I don't know if i need to change <= to < or check why InParamCount does not has the value of 2 (which are my number of parameters).
I can't really believe there's something wrong with the input parameter processing in itself. That would break the test suite within a second.
So I'm afraid you'll have to give more details on the way you provide these parameters. Seems like the error is telling you they are trying to fill one of the parameters but you didn't provide a value.
procedure TDatabase.ExecCommand(const Sql: string;
Params: array of String; Values: array of Variant);
var
qry: TZQuery;
i: integer;
Param: TParam;
begin
qry := TZQuery.Create(nil);
qry.Connection := fConnection;
try
qry.Close;
qry.SQL.Text := Sql;
for i := 0 to High(Params) do
begin
Param:= qry.Params.FindParam(Params[i]);
if Assigned(Param) then
Param.Value := Values[i];
end;
qry.ExecSQL;
finally
FreeAndNil(qry);
end;
end;
Is the code in your for loop effectively executed? And are the assignments effectively done? (checked by setting debug point)
It's always my first shot, but everything seems to be ok.
mdaems wrote:
If you want me to check, please attach a 'ready to compile' test project with a table reation/data fill script.
Ok i will do. Let me just finish my app (next week, i think) and i will post the entire code, with the database script and a some data to use.
For now i'm using queries with updatesql to do some insert/update operation like that.
I noted your table has 3 field set as not null, and you insert has only 2 params. I know autoinc should not be passed as parameter, but Have you tried pass 3 params?
I got this error message too on Firebird.
Somehow the names of the parameters, in your case :veiculos_id,:proxima_troca, where different from the names shown in the Params property editor.