代码:其中ipri是int类型的变量,pri是NUMBER类型的字段
strSql.Format("select * from flow where pri=%d",ipri);
BSTR bstrSQL = strSql.AllocSysString ();
db.m_pRecordset->Open(bstrSQL,(IDispatch*)                     db.m_pConnection,adOpenDynamic,adLockOptimistic,adCmdText);

while (!db.m_pRecordset->adoEOF)
{
TheValue=db.m_pRecordset->Fields->GetItem(_variant_t("USING"))->Value;
if(TheValue.vt!=VT_NULL)
{
cstring = (char*)_bstr_t(TheValue);
usebw=atoi(cstring.GetBuffer(0));
}
db.m_pRecordset->MoveNext();
}
db.m_pRecordset->Close();
}
catch(_com_error e)
{
AfxMessageBox(e.Description());
}编译无错,运行不出正确结果
将查询语句改为 strSql.Format("select * from flow where pri=%d",(TO_NUMBER)ipri);提示错误TO_NUMBER未定义,请问NUMBER类型的怎么查询呀?谢谢了!