Board index » delphi » how to pass parameter NULL?

how to pass parameter NULL?

How can I pass the NULL to parameter property of the TSQLQuery?

my sql query: INSERT INTO T VALUES (:X, :Y, :D)

How can pass NULL to :Y ?

--
----------------------------------------------
Ronaldo Rezende Vilela Luiz
Uberaba, MG - Brazil

 

Re:how to pass parameter NULL?


ParamByName('xxxx').clear;

Ronaldo Rezende Vilela Luiz wrote:

Quote
> How can I pass the NULL to parameter property of the TSQLQuery?

> my sql query: INSERT INTO T VALUES (:X, :Y, :D)

> How can pass NULL to :Y ?

> --
> ----------------------------------------------
> Ronaldo Rezende Vilela Luiz
> Uberaba, MG - Brazil

--
Guillermo Casta?o Acevedo
Gerente de Sistemas - Grupo Millennium Ltda
Guiller...@GrupoMillennium.com
http://www.GrupoMillennium.com

Re:how to pass parameter NULL?


I know this. But I receive a message error: "No value for parameter
'parameter_name' "
How can I exec the query with no parameter?

Re:how to pass parameter NULL?


And set the Bound property.  This is new.  I know I didn't have to do
this in D4, so I don't know when it was introduced.

<<From the Delphi Help>>
Indicates whether a value (NULL or otherwise) has been assigned to the
parameter.

Delphi syntax:

property Bound: Boolean;

C++ syntax:

__property bool Bound = {read=FBound, write=FBound, nodefault};

Description

Read Bound to determine whether a value has been assigned to the
parameter. Whenever a value is assigned to the TParam object, Bound is
automatically set to true. Set Bound to false to undo the setting of a
value. The Clear method replaces the value of the parameter with NULL,
but does not set Bound to false. However, if the Clear method is used to
bind the parameter to a NULL value, Bound must be separately set to true.

Datasets that represent queries and stored procedures use the value of
Bound to determine whether to assign a default value for the parameter.
If Bound is false, datasets that represent queries attempt to assign a
value from the dataset indicated by their DataSource property.
Similarly, when Bound is false, datasets that represent stored
procedures attempt to supply a value directly from the server.

Ronaldo Rezende Vilela Luiz wrote:

Quote
> I know this. But I receive a message error: "No value for parameter
> 'parameter_name' "
> How can I exec the query with no parameter?

--
Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

http://www.bss-software.com
http://sourceforge.net/projects/dbexpressplus

Re:how to pass parameter NULL?


I doen't completely understand. To set the .open, I must set the Bound
property to true?

"Thomas Miller" <tmil...@bss-software.com> escreveu na mensagem
news:3e5f878a@newsgroups.borland.com...

Quote
> And set the Bound property.  This is new.  I know I didn't have to do
> this in D4, so I don't know when it was introduced.

> <<From the Delphi Help>>
> Indicates whether a value (NULL or otherwise) has been assigned to the
> parameter.

> Delphi syntax:

> property Bound: Boolean;

> C++ syntax:

> __property bool Bound = {read=FBound, write=FBound, nodefault};

> Description

> Read Bound to determine whether a value has been assigned to the
> parameter. Whenever a value is assigned to the TParam object, Bound is
> automatically set to true. Set Bound to false to undo the setting of a
> value. The Clear method replaces the value of the parameter with NULL,
> but does not set Bound to false. However, if the Clear method is used to
> bind the parameter to a NULL value, Bound must be separately set to true.

> Datasets that represent queries and stored procedures use the value of
> Bound to determine whether to assign a default value for the parameter.
> If Bound is false, datasets that represent queries attempt to assign a
> value from the dataset indicated by their DataSource property.
> Similarly, when Bound is false, datasets that represent stored
> procedures attempt to supply a value directly from the server.

> Ronaldo Rezende Vilela Luiz wrote:
> > I know this. But I receive a message error: "No value for parameter
> > 'parameter_name' "
> > How can I exec the query with no parameter?

> --
> Thomas Miller
> Delphi Client/Server Certified Developer
> BSS Accounting & Distribution Software
> BSS Enterprise Accounting FrameWork

> http://www.bss-software.com
> http://sourceforge.net/projects/dbexpressplus

Re:how to pass parameter NULL?


.Clear;
.Bound := True;

It is right in the help file.  Please make a little effort!

Ronaldo Rezende Vilela Luiz wrote:

Quote
> I doen't completely understand. To set the .open, I must set the Bound
> property to true?

> "Thomas Miller" <tmil...@bss-software.com> escreveu na mensagem
> news:3e5f878a@newsgroups.borland.com...

>>And set the Bound property.  This is new.  I know I didn't have to do
>>this in D4, so I don't know when it was introduced.

>><<From the Delphi Help>>
>>Indicates whether a value (NULL or otherwise) has been assigned to the
>>parameter.

>>Delphi syntax:

>>property Bound: Boolean;

>>C++ syntax:

>>__property bool Bound = {read=FBound, write=FBound, nodefault};

>>Description

>>Read Bound to determine whether a value has been assigned to the
>>parameter. Whenever a value is assigned to the TParam object, Bound is
>>automatically set to true. Set Bound to false to undo the setting of a
>>value. The Clear method replaces the value of the parameter with NULL,
>>but does not set Bound to false. However, if the Clear method is used to
>>bind the parameter to a NULL value, Bound must be separately set to true.

>>Datasets that represent queries and stored procedures use the value of
>>Bound to determine whether to assign a default value for the parameter.
>>If Bound is false, datasets that represent queries attempt to assign a
>>value from the dataset indicated by their DataSource property.
>>Similarly, when Bound is false, datasets that represent stored
>>procedures attempt to supply a value directly from the server.

>>Ronaldo Rezende Vilela Luiz wrote:

>>>I know this. But I receive a message error: "No value for parameter
>>>'parameter_name' "
>>>How can I exec the query with no parameter?

>>--
>>Thomas Miller
>>Delphi Client/Server Certified Developer
>>BSS Accounting & Distribution Software
>>BSS Enterprise Accounting FrameWork

>>http://www.bss-software.com
>>http://sourceforge.net/projects/dbexpressplus

--
Thomas Miller
Delphi Client/Server Certified Developer
BSS Accounting & Distribution Software
BSS Enterprise Accounting FrameWork

http://www.bss-software.com
http://sourceforge.net/projects/dbexpressplus

Re:how to pass parameter NULL?


You need set  the type of field.

ParamByName('xxxx').DataType := ftXXXXX
ParamByName('xxxx').clear;

Luciano

"Ronaldo Rezende Vilela Luiz" <ronaldinh...@bol.com.br> wrote in message
news:3e5f75e5$1@newsgroups.borland.com...

Quote
> I know this. But I receive a message error: "No value for parameter
> 'parameter_name' "
> How can I exec the query with no parameter?

Re:how to pass parameter NULL?


I solve it.
The problem is that you must set the type of parameter.

Other Threads