Hi. I want to know what is wrong with this code:
Code:
CRecordset rSet(&DBConn);
strQuery="SELECT * FROM People WHERE Names LIKE '*'";
rSet.Open(CRecordset::forwardOnly,(LPCSTR) strQuery);
if(!rSet.IsEOF())
{
rSet.MoveFirst();
while(!rSet.IsEOF())
{
rSet.GetFieldValue("Names",strData);
m_people_combo.AddString((LPCSTR) strData);
rSet.MoveNext();
}
}
rSet.Close();
I know that this query should return results- it should return all the records in the table and I have some. But it doesn't return any records so the first condition is not true and it doesn't enter the loop. I tried to execute this query directly in MS Access and it works there. Any suggestions?
How can I find out whether or not ODBC supports "LIKE" conditions?
P.S. the DBConn connection is initialized properly- I know that because I use it in other places in the program.