HELP - Setting TQuery Parameters to Null

HELP - Setting TQuery Parameters to Null

Post by Gordon Hoot » Mon, 04 Dec 1995 04:00:00



Can some Guru help. I am using the parameters in SQL and TQuery to
retrieve only some records, but need to "switch the parameter off on
menu command to allow all records to be sourced.

Is there a way to set the SQL dynamic parameter (in this case .asstring)
to a null value to allow all records to be retrived by the SQL

 
 
 

HELP - Setting TQuery Parameters to Null

Post by David McWhirt » Tue, 05 Dec 1995 04:00:00


: Can some Guru help. I am using the parameters in SQL and TQuery to
: retrieve only some records, but need to "switch the parameter off on
: menu command to allow all records to be sourced.

: Is there a way to set the SQL dynamic parameter (in this case .asstring)
: to a null value to allow all records to be retrived by the SQL
:  

  Use the Clear Method for the Params Preperty...

   Query.Params[1].Clear;

  That will set Params[1] to Null...

-David

--
________________________________________________________________________
        _/                _/      _/                  

 _/   _/   _/_/ _/   _/ _/ _/   _/ _/ _/ _/ _/      
_/   _/ _/  _/  _/ _/  _/ _/   _/ _/ _/ _/ _/        David L. McWhirter
_/_/_/ _/_/_/    _/   _/  _/_/_/ _/    _/   _/_/_/   Lake Forest, CA

 
 
 

HELP - Setting TQuery Parameters to Null

Post by Brian Murra » Thu, 07 Dec 1995 04:00:00



> Is there a way to set the SQL dynamic parameter (in this case .asstring)
> to a null value to allow all records to be retrived by the SQL

I believe this will work:

  Query1.ParamByName('Param1').Clear;

--


Office of Admnistrative Systems
Vanderbilt University

 
 
 

1. How to pass parameter to TQuery and retrieve value from TQuery

Hello

I have created a TQuery, SQLSumStockAmt, like this

Select Sum( Price * Qty) TotAmt
  From "stock.db" stock
Where PurId = :Pur_Id

Then in the Data Module, I assign the value to the parameter and open
the TQuery

  SQLSumStockAmt.Params[0].AsInteger := PurchasePurId.Value;
  SQLSumStockAmt.Open;

But when I  ShowMessage(IntToStr(Round(SQLSumStockAmtTotAmt.Value)));

The value is wrong!

What goes wrong?

pc

2. SQLXML and DB2

3. SET NULL / SET NOT NULL

4. Latest drivers

5. Where in the world is David Hochman?

6. global variables in dts

7. Result sets of a TQuery feed into another TQuery

8. TQuery on TQuery result set??

9. Help needed: Setting parameters in parameter queries

10. Setting a NULL parameter with Oracle ODBC

11. Stored procedure - OUTPUT parameters are default if first one set to NULL