从Access的一个字段读出的货币型字段怎么转成实型变量进行计算。
另外这计算结果怎么写回到Access数据库中。
多谢各位高人。

解决方案 »

  1.   

    float f;
    var=pRecordset->GetCollect("你的字段名");
    if(var.vt!=VT_NULL)
    {
    f=float(atof((LPCSTR)_bstr_t(var)));
    }直接这么转就可以了
    VC我没把货币转到float型但是用vb我转过,直接这么类型转换就可以了计算结果怎么回去??
    用update 的sql语言更新你的记录咯
    至于货币型,我一直把他当float型那么处理的,呵呵
    你写sql语句的时候也把当做float那么处理吧
      

  2.   

    COleCurrency Class MembersSetCurrency Sets the value of this COleCurrency object. 
    Format Generates a formatted string representation of a COleCurrency object. 
    ParseCurrency Reads a CURRENCY value from a string and sets the value of COleCurrency.