STDMETHODIMP CNewMail::put_SendAsHTML(BOOL newVal)
{
// TODO: Add your implementation code here
    SendAsHTML=newVal;
return S_OK;
}
当我从数据库中提取一个布尔值时,发现SendAsHTML总是FALSE
例如:cc.SendAsHTML=rs("AUTH")  
但如果cc.SendAsHTML=true 就不会有问题。似乎cc.SendAsHTML需要一个长整形的值。怎么办才能使它接受布尔值?

解决方案 »

  1.   

    cc.SendAsHTML=rs("AUTH") is not safe to write code like that. When u debugging, pls add some debug statement to make sure what value it returns before send the question to the forum.rs("") should return a VT_BOOL.
    u should
    CComVariant vtAuth = rs("AUTH");
    if (vtAuth.vt != VT_BOOL)
        error code herecc.SendAsHTML = (vtAuth.boolVal == VT_TRUE)!TRUE:FALSE;in VB, u can write the similar code to make check before use.or u can define put_SendAsHTML as VARIANT_BOOL to simplified the last statement.
      

  2.   

    又是一个不眠夜,CSDN要戒严了。记得葛优(演的一个人物)曾经说过:“……什么人都可以惹,唯独小人不能沾。”初春的一场小雪,纷纷扬扬地下着,掩饰了大地,掩盖了一切人间的罪恶。上帝说:“有阳光就有黑暗,有善举就有罪过。饶恕他吧。”