如何解决避免读数据中空白字段出错的问题?? select isnull(字符型,'') ,isnull(数值型,0) from table 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 select isnull(字段,'默认值') 别名 from 表 select ...,isnull(字段,代替空的值),...或者select ...,case when 字段 is null then 代替空的值 else 字段 end as 字段,... _variant_t vComponentBoundary;CString m_DBAmendComponentBoundary;vComponentBoundary = pRecordset->GetCollect("部件边界");dlg.m_DBAmendComponentBoundary = (LPCTSTR)(_bstr_t)vComponentBoundary;然后就出错。我说的明白吗?请指教,多谢! 我知道在VB中用 tb.fields("字段名") & "" 可以避免字段值为NULL是出错的问题 isnull(字段,'默认值')的意思是是空值就区后面的默认值明白了吗 不好意思,各位,我很想结束这个问题,可是你们的回答我不是很清楚。我的问题出在 _variant_t vComponentBoundary;CString m_DBAmendComponentBoundary;vComponentBoundary = pRecordset->GetCollect("部件边界");dlg.m_DBAmendComponentBoundary = (LPCTSTR)(_bstr_t)vComponentBoundary;因为部件边界在数据库里面是空的,所以出错了。默认值是什么呢?怎么赋值啊? 前面加个判断是否是NULL就不行了吗。 SQL server 存储过程报错中途停止,如何报错继续执行? 用in还是or好 不使用 not exists 如何改写这条语句? 数据库群集端口访问和连接问题 新手求助 谢谢了 邹老大,兄弟有点没太整明白,麻烦你结合个小例帮我讲讲 在连接到 SQL Server 2005 时,在默认的设置下 SQL Server 不允许进行远程连接可能会导致此失败 登陆问题 有人帮忙吗?谢谢了! CDA 有关表的创建问题,在线等待 怎么倒入MDF和LDF文件?
或者
select ...,case when 字段 is null then 代替空的值 else 字段 end as 字段,...
CString m_DBAmendComponentBoundary;
vComponentBoundary = pRecordset->GetCollect("部件边界");
dlg.m_DBAmendComponentBoundary = (LPCTSTR)(_bstr_t)vComponentBoundary;
然后就出错。我说的明白吗?请指教,多谢!
明白了吗
我的问题出在
_variant_t vComponentBoundary;
CString m_DBAmendComponentBoundary;
vComponentBoundary = pRecordset->GetCollect("部件边界");
dlg.m_DBAmendComponentBoundary = (LPCTSTR)(_bstr_t)vComponentBoundary;
因为部件边界在数据库里面是空的,所以出错了。
默认值是什么呢?
怎么赋值啊?