CString str = "something";
CDaoDatabase db;
//db open
CDaoRecordset rs(&db);
rs.Open(AFX_DAO_USE_DEFAULT_TYPE,"select * from mydb");
COleVariant searched(str);
BOOL bFound = rs.Seek("=",searched);
对于此语句,VS2008返回
error C2664: 'BOOL CDaoRecordset::Seek(LPCTSTR,COleVariant *,COleVariant *,COleVariant *)' : cannot convert parameter 2 from 'COleVariant' to 'COleVariant *'.
如何将
COleVariant
转换为指针? 最佳答案
使用地址运算符“&”
BOOL bFound = rs.Seek("=",&searched);