Watch, Follow, &
Connect with Us

Please visit our new home
community.embarcadero.com.

Public Report
Report From: Delphi-BCB/Database/DBExpress    [ Add a report in this area ]  
Report #:  103570   Status: Reported
TDBXParameter.Value is TDBXWritableValue and TDBXWritableValue has more Set..X methods. So you can add some easy setting property..
Project:  Delphi Build #:  16.0.4358.45540
Version:    16.3 Submitted By:   Tugrul HELVACI
Report Type:  Suggestion / Enhancement Request Date Reported:  2/21/2012 12:46:54 AM
Severity:    Commonly encountered problem Last Updated:
Platform:    All platforms Internal Tracking #:  
Resolution: None  Resolved in Build: : None
Duplicate of:  None
Voting and Rating
Overall Rating: No Ratings Yet
0.00 out of 5
Total Votes: 10
Description
TDBXParameter.Value is TDBXWritableValue and TDBXWritableValue has more Set..X methods. So you can add some easy setting property like this;

  TDBXParameterHelper = class helper for TDBXParameter
  public
    procedure SetValue(const AValue : TValue);

    property ValueEx : TValue write SetValue;
  end;

procedure TDBXParameterHelper.SetValue(const AValue: TValue);
var
  ctx : TRttiContext;
  typ : TRttiType;
  mtd : TRttiMethod;
  val : UnicodeString;
begin
  typ := ctx.GetType(Self.Value.ClassType);
  val := AValue.ToString;

  if typ <> nil then
  begin
    mtd := typ.GetMethod('SetAsString');
    if mtd <> nil then
      mtd.Invoke(Self.Value, [ val ]);
  end;
end;
Steps to Reproduce:
None
Workarounds
None
Attachment
None
Comments

None

Server Response from: ETNACODE01