Parameterized query 
Author Message
 Parameterized query

I want to use parameterized query.
Is it possible to specify as a parameter variable of class
CTime.
I am using MSSQL and the field there has type: datetime;

If I specify only the first 2 param. everiting is working,
if I add the third param, return error!!!

Example source:

//////////////////////////////////////////////
CReqDB m_ReqSet; //CRecordset
m_ReqSet.m_strFilter =
     "used = ? and serialnumber > ? and init_time < ?";
m_ReqSet.m_usedParam = 1;
m_ReqSet.m_serialnumber = "100000000002";
m_ReqSet.m_init_timeParam = CTime::GetCurrentTime();

m_ReqSet.Open();

if (!m_ReqSet.IsEOF())
{
        m_ReqSet.MoveFirst();
        CString strShow = m_ReqSet.m_serialnumber;
        AfxMessageBox(strShow);

Quote:
}

m_ReqSet.Close();

////////////////////

Thanks



Mon, 23 Aug 2004 20:16:17 GMT  
 Parameterized query
HI!!!

I solve it!
Actually the source code was correct,
except the fact I was set m_nParams=2.
I changed it to m_nParams=3.
And It works!



Tue, 24 Aug 2004 07:40:29 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Dynamically Creating parameterized queries using VC++

2. ADO Parameterized Queries

3. Parameterized queries - Please help

4. Calling MSQuery from Visual C++ to run a parameterized query

5. COleVariant and DAO parameterized queries

6. ODBC + Parameterized Queries + Additional Filters (Access 2000)

7. CRecordset, Oracle7.3 and parameterized queries

8. ADO Parameterized queries

9. Dynamically Creating parameterized queries using VC++

10. Parameterized query using CRecordset

11. Problems with Visual C++, DAO, and Parameterized Queries

12. Dynamically Creating parameterized queries using VC++

 

 
Powered by phpBB® Forum Software