ODBC CRecordset m_strFilter CString question 
Author Message
 ODBC CRecordset m_strFilter CString question

Jack,

You're pretty close to having it.  Actually string parameters need to be
enclosed in single quotes (apostrophes).  It's a SQL thing, actually, not an
MFC thing.

Try this:

dlg.m_pSet->m_strFilter.Format("[PStockNumber] = '%s' ", m_stocknumber);

TFM3

Note: Spam-resistant e-mail address


Quote:
> how do you create a search string to search for a specific entry in a
> colomn, or attribute in a CRecordset?

> I know how to make one for a column of type double, but i can't figure
> out how to make one for a CString;

> // heres the one for the double, it works fine
> // [CPhoneNumber] is the column which entries are type double and
> // m_phonenumber is a type double as well
> dlg.m_pSet->m_strFilter.Format("[CPhoneNumber] = %9.0f",
> m_phonenumber);

> file://But when i try to search for a CString I am not sure what is the
> proper syntax
> // [PStockNumber] is a column in my database with entries of type
> CString and m_stocknumber is also of type CString

> // i've tryed the following, but it doesn't work
> dlg.m_pSet->m_strFilter = "[PStockNumber] = m_stocknumber";
> dlg.m_pSet->m_strFilter.Format("PStockNumber] = %s", m_stocknumber";

> can someone help

> Thanks,
> Jack



Wed, 14 May 2003 03:00:00 GMT  
 ODBC CRecordset m_strFilter CString question
how do you create a search string to search for a specific entry in a
colomn, or attribute in a CRecordset?

I know how to make one for a column of type double, but i can't figure
out how to make one for a CString;

// heres the one for the double, it works fine
// [CPhoneNumber] is the column which entries are type double and
// m_phonenumber is a type double as well
dlg.m_pSet->m_strFilter.Format("[CPhoneNumber] = %9.0f",
m_phonenumber);

//But when i try to search for a CString I am not sure what is the
proper syntax
// [PStockNumber] is a column in my database with entries of type
CString and m_stocknumber is also of type CString

// i've tryed the following, but it doesn't work
dlg.m_pSet->m_strFilter = "[PStockNumber] = m_stocknumber";
dlg.m_pSet->m_strFilter.Format("PStockNumber] = %s", m_stocknumber";

can someone help

Thanks,
Jack



Thu, 15 May 2003 10:25:43 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Crecordset is misbehaving for m_strFilter member

2. CRecordset and AND in m_strFilter

3. CRecordset is misbehaving for m_strFilter member

4. Problems with CRecordset::m_strFilter and Requery()

5. CRecordset.m_strFilter size

6. ODBC, m_strFilter ?

7. CRecordset question - CString and PBYTE conversion

8. CRecordset question - CString and PBYTE conversion

9. CDaoRecordset/CRecordset/ODBC Question

10. Questions on ODBC & CRecordset

11. ODBC, CRecordSet - question

12. ODBC and CRecordSet Sort Question

 

 
Powered by phpBB® Forum Software