Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delphi - Clear Param Data for TADOStoredProc

for BDE, we can clear the param data like below.

 with tstoredproc do
    begin
    .
    .
      for i := 0 to ParamCount - 1 do Params[i].Clear;
    .
    .

    end

how to do the same for ADO Dataset's? I do not want to create params. i am using TADOStoredProc component and it is having all the params. i Just need to clear data and assign new data.

with TADoStoredProc do
begin
.
.
 for i := 0 to ParamCount - 1 do Parameters[i].Value := null; -- is this right? or can i use below line of code
 Parameters.Refresh
.
.
end;
like image 207
DelphiLearner Avatar asked Dec 08 '25 16:12

DelphiLearner


1 Answers

BDE TParam.Clear sets Unassigned for the data member of the parameter.

i Just need to clear data and assign new data

Why do you need to clear the data/value in the first place? simply assign the new values.

If you need to explicitly pass null to the stored procedure parameter you can use e.g.

Parameters[i].Value := Unassigned
like image 129
kobik Avatar answered Dec 10 '25 17:12

kobik



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!