Code: Select all
with UniSQL1 do
begin
SQL.Clear;
SQL.Add('INSERT tblPedidosHd2 (TiendaId,ClienteId,Tipo,PreviewsMes,Fecha,Usuario)');
SQL.Add('VALUES(:TiendaId,:ClienteId,''A'',:PreviewsMes,GetDate(),:Usuario)');
SQL.Add('SET :newid = SCOPE_IDENTITY()');
ParamByName('TiendaId').AsInteger:=Tienda;
ParamByName('ClienteId').AsInteger:=DBLookUpComboBox1.KeyValue;
if Checkbox1.Checked then ParamByName('PreviewsMes').AsString:='D'+FormatDateTime('yymm',Date);
ParamByName('Usuario').AsString:=GetCurrentUserName;
ParamByName('newid').DataType := ftInteger;
ParamByName('newid').ParamType:=ptInputOutput;
Execute;
PedidoId:=ParamByName('newid').AsInteger;
end;
Code: Select all
Parameter[4]:newid - invalid ParamType(Status=1h).
This type of insert code normally works perfectly now suddenly in this case its not working, any pointers?