select isnull(字符型,'') ,isnull(数值型,0) from table

解决方案 »

  1.   

    select isnull(字段,'默认值') 别名 from 表
      

  2.   

    select ...,isnull(字段,代替空的值),...
    或者
    select ...,case when 字段 is null then 代替空的值 else 字段 end as 字段,...
      

  3.   

    _variant_t vComponentBoundary;
    CString m_DBAmendComponentBoundary;
    vComponentBoundary = pRecordset->GetCollect("部件边界");
    dlg.m_DBAmendComponentBoundary = (LPCTSTR)(_bstr_t)vComponentBoundary;
    然后就出错。我说的明白吗?请指教,多谢!
      

  4.   

    我知道在VB中用 tb.fields("字段名") & "" 可以避免字段值为NULL是出错的问题
      

  5.   

    isnull(字段,'默认值')的意思是是空值就区后面的默认值
    明白了吗
      

  6.   

    不好意思,各位,我很想结束这个问题,可是你们的回答我不是很清楚。
    我的问题出在
     _variant_t vComponentBoundary;
    CString m_DBAmendComponentBoundary;
    vComponentBoundary = pRecordset->GetCollect("部件边界");
    dlg.m_DBAmendComponentBoundary = (LPCTSTR)(_bstr_t)vComponentBoundary;
    因为部件边界在数据库里面是空的,所以出错了。
    默认值是什么呢?
    怎么赋值啊?
      

  7.   

    前面加个判断是否是NULL就不行了吗。