RAD Studio VCL Reference
|
Indicates whether the value assigned to the parameter is NULL (blank).
property IsNull: Boolean;
__property Boolean IsNull;
Inspect IsNull to discover if the value of the parameter is NULL, indicating the value of a blank field. NULL values can arise in the following ways:
Assigning the value of another, NULL, parameter.
Assigning the value of a blank field.
Calling the Clear method.
C++ Examples:
/* This example requires a TClientDataSet and a button on a form. */ void __fastcall TForm1::Button1Click(TObject *Sender) { for (int I = 0; I < CDS->Params->Count; I++) { if (CDS->Params->Items[I]->IsNull && CDS->Params->Items[I]->DataType == ftInteger) CDS->Params->Items[I]->AsInteger = -1; }} void __fastcall TForm1::FormCreate(TObject *Sender) { CDS->LoadFromFile(GetCurrentDir() + L"/../CDS.XML"); CDS->Params->CreateParam(ftInteger, "StateParam", ptInput); CDS->Params->CreateParam(ftInteger, "MyParam", ptInput); }
Delphi Examples:
{ This example requires a TClientDataSet and a button on a form. } {$IFNDEF UNICODE} uses SwSystem; {$ENDIF} procedure TForm1.Button1Click(Sender: TObject); var I : Integer; begin { Assign -1 to any integer parameter which 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;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|