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

08-06 04:58