“精度无效”错误
编写如下方法将自己写的一个十进制类插入数据库中,测试程序报“精度无效”错误”,请各位解释是什么原因;
void AdoStatement::setDecimal(const string &placeHolder,const Decimal& x) throw(SQLException)
{
try
{
pParam=pCommand->CreateParameter(placeHolder.c_str(),adDecimal,adParamInput,sizeof(x.toString()),x.toString().c_str());
pCommand->Parameters->Append(pParam);
}
catch(_com_error &e)
{
_bstr_t strErr(e.Source()+" "+e.Description());
throw SQLException((LPCSTR) strErr,-1,0);
}
catch(...)
{
throw SQLException("发生未知错误!",-1,0);
}
}