erro batch insert firebird
Posted: Fri 26 Aug 2016 11:26
I am using the following code to perform an insert 100 records, and returns me the following error:
var
I: Integer;
begin
UniQuery1.Close;
UniQuery1.SQL.Text := 'UPDATE OR INSERT INTO CARTAS(COD_CARTA, NOME_CARTA) VALUES(:A, :B) MATCHING( COD_CARTA)';
UniQuery1.Params.ValueCount := 100;
for I := 0 to 100 -1 do
begin
UniQuery1.Params[0].AsInteger := i + 1;
UniQuery1.Params[1].AsString := 'CARTA ';
end;
UniQuery1.Execute(100);
ShowMessage('OK');
DA Dynamic SQL Error
Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255
I always have to specify the type of parameters before filling in the parameters array, as example?
Query1.Params[0].DataType := ftInteger;
I changed the command, find that does not work with update or insert into sql clausa. more noticed a strange thing, the string type parameter so writes the first character in the database.
UniQuery1.Params[1].AsString := 'CARTA '; -> so the letter C recorded in the database, even passing the type parameter to ftstring
var
I: Integer;
begin
UniQuery1.Close;
UniQuery1.SQL.Text := 'UPDATE OR INSERT INTO CARTAS(COD_CARTA, NOME_CARTA) VALUES(:A, :B) MATCHING( COD_CARTA)';
UniQuery1.Params.ValueCount := 100;
for I := 0 to 100 -1 do
begin
UniQuery1.Params[0].AsInteger := i + 1;
UniQuery1.Params[1].AsString := 'CARTA ';
end;
UniQuery1.Execute(100);
ShowMessage('OK');
DA Dynamic SQL Error
Too many Contexts of Relation/Procedure/Views. Maximum allowed is 255
I always have to specify the type of parameters before filling in the parameters array, as example?
Query1.Params[0].DataType := ftInteger;
I changed the command, find that does not work with update or insert into sql clausa. more noticed a strange thing, the string type parameter so writes the first character in the database.
UniQuery1.Params[1].AsString := 'CARTA '; -> so the letter C recorded in the database, even passing the type parameter to ftstring