TParamsItems (Delphi)
Description
This example requires a TClientDataSet and a button on a form.
Code
{$IFNDEF UNICODE}
uses SwSystem;
{$ENDIF}
procedure TForm1.Button1Click(Sender: TObject);
var
I : Integer;
begin
{ Assign -1 to any integer parameter that does not have a value. }
for I := 0 to CDS.Params.Count - 1 do
if (CDS.Params.Items[I].IsNull) and
(CDS.Params.Items[I].DataType = ftInteger) then
{ Items is the default property, so you can omit its name. }
CDS.Params[I].AsInteger := -1;
end;
procedure TForm1.FormCreate(Sender: TObject);
begin
{$IFDEF UNICODE}
CDS.LoadFromFile(GetCurrentDir + '\CDS.XML');
{$ELSE}
CDS.LoadFromFile(gsAppPath + 'CDS.XML');
{$ENDIF}
CDS.Params.CreateParam(ftInteger, 'StateParam', ptInput);
CDS.Params.CreateParam(ftInteger, 'MyParam', ptInput);
end;
Uses
- Data.DB.TParams.Items ( fr | de | ja )
- System.Classes.TCollection.Count ( fr | de | ja )
- Data.DB.TParam.DataType ( fr | de | ja )
- Data.DB.TParam.IsNull ( fr | de | ja )
- Data.DB.TParam.AsInteger ( fr | de | ja )