Board index » delphi » Pass null as a parameter to an insert/update query

Pass null as a parameter to an insert/update query


2003-07-24 01:53:10 AM
delphi195
I need to know how to pass a null value to a parameter that is part of an insert/update query. The value may not always be null, but if it doesn't have a value then I want to pass null instead of ''.
Thanks
Dwaine
 
 

Re:Pass null as a parameter to an insert/update query

"Dwaine Horton" <XXXX@XXXXX.COM>writes news:3f1ecb86$XXXX@XXXXX.COM...
Quote
I need to know how to pass a null value to a parameter that is part of an
insert/update query. The value may not always be null, but if it doesn't
have a value then I want to pass null instead of ''.
Try .AsVariant:=Null.
Cheers,
Ignacio
 

Re:Pass null as a parameter to an insert/update query

"Ignacio Vazquez" <ivazquezATorioncommunications.com>writes:
Quote
"Dwaine Horton" <XXXX@XXXXX.COM>writes news:3f1ecb86$XXXX@XXXXX.COM...
>I need to know how to pass a null value to a parameter that is part of an
insert/update query. The value may not always be null, but if it doesn't
have a value then I want to pass null instead of ''.

Try .AsVariant:=Null.

Cheers,
Ignacio


I found the solution. TParam.bound := False and then set TParam.Clear; This will cause a null value to be inserted or updated.