Subject Re: [IBO] Re: Reset params if a TIB_StoredProc
Author Helen Borrie
At 06:43 PM 6/05/2004 +0000, you wrote:
> > >I have solve it doing: sp.ParamByName("TIME").Clear();
> > >
> > >But I am looking for a function to "reset" all parameters.
> >
> > sp.Params.ClearBuffers;
> >
> > Helen
>In the ExecSQL help it's clearly stated, but I discover it by "the
>hard way". Maybe there should be a list of those "tips" somewhere.

Seems a good idea.

>And, is the following bug for Jason? If I use
>sp.ParamByName("MYNAME").Value := NULL, it retains the previous value
>(MYNAME is a varchar field).

If it doesn't throw an exception, it's a bug. Delphi doesn't have NULL. I
seem to recall you can assign NULL by using some trick (NullAsVar and
assigning it to the Value property?). Apart from that, using the Clear
method is the only way I know to get a parameter to be NULL.

>sp.ParamByName("MYNAME").AsString := '' works fine instead.

If you want to store null rather than emptystring, you can set the
BlankIsNull property.

>Anyway, sp.Params.ClearBuffers( rsNone ) seems to be the correct syntax.

Apologies for that, I never use ClearBuffers, either. I'll always have a
method when assigning parameters and assign all of them. If I have a
specific parameter that repeats with the same value, I'll use a function.
Thus I simply never get the problem of values left over from another call.