CRecordset and stored procedures with params that default to NULL 
Author Message
 CRecordset and stored procedures with params that default to NULL

I have the following stored procedure on SQL Server:




Now I like to use this procedure to create a Recordset as follows:

CString Procedure = _T("{call sp_GetSuccessfulTrx (?, ?, ?)}");

pSAMURAIManagerApp->m_pSuccessfulTrxSet = new
CSuccessfulTrxSet(&pSAMURAIManagerApp->m_XBBSNTTrxDB);
m_pSet = pSAMURAIManagerApp->m_pSuccessfulTrxSet;
m_pSet->Open(CRecordset::snapshot, Procedure);

To fetch the parameters I use the following code:

    pFX->SetFieldType(CFieldExchange::param);
    RFX_Long(pFX, _T("Days"), m_Days);
    RFX_Text(pFX, _T("From"), m_StartDate);
    RFX_Text(pFX, _T("Until"), m_EndDate);

The problem is, that the stored procedure can take parameters with NULL
values. So I should be able to set one or more of the above input params to
NULL. I tried the following BEFORE opening the recordset:

    m_pSet->SetFieldNull(&m_pSet->m_Days);
    m_pSet->SetFieldNull(&m_pSet->m_StartDate);
    m_pSet->SetFieldNull(&m_pSet->m_EndDate);

This code ends up in an ASSERT in file dbcore.cpp

How can I set input parameters for a stored procedure to NULL??

Any help would be greatly appreciated.

Many thanks,

Thomas

--
------------------------------------------------------------------
 SMART Solutions GmbH
 Oberwiesenstrasse 5, P.O. Box 152
 8304 Wallisellen - Switzerland

 Tel. +41 1 883 16 83
 FAX  +41 1 883 16 79


 Internet: http://www.*-*-*.com/
----------------------------------------------------------------



Sun, 04 Jul 1999 03:00:00 GMT  
 
 [ 1 post ] 

 Relevant Pages 

1. CRecordset and output params from a stored procedure

2. ATL Consumer and Stored Procedures Params

3. ATL Consumer and Stored Procedures Params

4. what is the command syntax for calling a stored procedure with output params

5. How to pass NULL params in RFX for CRecordset in SQL Server/ODBC

6. How to pass NULL params in RFX for CRecordset in SQL Server/ODBC

7. Passing NULL values to a stored procedure????

8. NULL as parm to stored procedure

9. NULL parms in stored procedure

10. Calling store procedure using CDatabase/CRecordset

11. Stored procedures accessing more than one server in a single CDatabase and CRecordset object

12. CRecordset updated via stored procedure

 

 
Powered by phpBB® Forum Software