Data.Win.ADODB.TParameters.ParamByName

From RAD Studio API Documentation
Jump to: navigation, search

Delphi

function ParamByName(const Value: WideString): TParameter;

C++

TParameter* __fastcall ParamByName(const System::WideString Value);

Properties

Type Visibility Source Unit Parent
function public
Data.Win.ADODB.pas
Data.Win.ADODB.hpp
Data.Win.ADODB TParameters

Description

Locates the parameter with a given name.

Use ParamByName method to find a parameter with the name specified in Value. If a match is found, ParamByName returns a reference to the corresponding TParameter object. Otherwise, the TParameter reference is nil (Delphi) or NULL (C++) and an exception is raised. Use this method rather than a direct reference to the Items property to avoid depending on the order of the entries.



ADOQuery1.Parameters.ParamByName('Verb').Value := 'propitiate';
ADOQuery1.Open;



ADOQuery1->Parameters->ParamByName("Verb")->Value = "propitiate";
ADOQuery1->Open();



To locate a parameter by name without raising an exception if the parameter is not found, use the FindParam method.

To locate more than one parameter at a time, by name, use the GetParamList method instead. To get only the value of a named parameter, use the ParamValues property.

Note: ParamByName operates with the name of a parameter as it appears in an SQL statement or stored procedure, not the Name property of a TParameter object. The two ways of referring to a parameter should not be confused.

See Also