0
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为指针?

4

1 回答 1

1

使用地址运算符 '&'

BOOL bFound = rs.Seek("=",&searched);
于 2012-12-07T14:29:10.470 回答