CDao记录集::查找错误


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);

相关内容

  • 没有找到相关文章

最新更新