困扰已久的Null问题!

ck4 2002-07-09 07:07:57
从记录集取数据赋给msflexgrid时,若该字段为null就会出错。
我写了一个函数来处理,若为null则返回"",但还是不行!
不知怎么处理好了!
各位指教!
...全文
65 8 打赏 收藏 转发到动态 举报
写回复
用AI写文章
8 条回复
切换为时间正序
请发表友善的回复…
发表回复
ck4 2002-07-09
  • 打赏
  • 举报
回复
Thank U all!
cqq_chen 2002-07-09
  • 打赏
  • 举报
回复
对于TEXT的做法,因为没有用过MshFlexGrid,所以你得自己试试
txt_name.text=sc.Fields("Fname") & ""
飞不动 2002-07-09
  • 打赏
  • 举报
回复
public NullValue(FS as Fields)
if IsNull(FS.value) then
NullValue=""
else
Nullvalue=FS.value
endif
end Sub

以上是我常用的一个函数.写MshFlexGrid控件时用的,你可以参考一下!
还有,当你写网格的时候,对于字符型的数据,最好用Trim去掉空格
ayusay 2002-07-09
  • 打赏
  • 举报
回复

xx=rst.fields("fields") & ""

一切OK!
kmcyz 2002-07-09
  • 打赏
  • 举报
回复
msflexgrid1.row=rownum
msflexgrid1.col=colnum
msflexgrid1.Text=recordset!fieldname & ""
kmcyz 2002-07-09
  • 打赏
  • 举报
回复
msflexgrid1.row=rownum
msflexgrid.col=colnum
msflexgrid.Text=recordset!fieldname & ""
shuaishen12 2002-07-09
  • 打赏
  • 举报
回复
if isnull(rst.fields) = true then
'添加返回""代码
else

end if
shuaishen12 2002-07-09
  • 打赏
  • 举报
回复
ISNULL( ) Function

Returns true (.T.) if an expression evaluates to a null value; otherwise, ISNULL( ) returns false (.F.).

Syntax

ISNULL(eExpression)

Returns

Logical

Arguments

eExpression

Specifies the expression to evaluate.

Remarks

Use ISNULL( ) to determine if the contents of a field, memory variable, or array element contains a null value, or if an expression evaluates to a null value.

7,763

社区成员

发帖
与我相关
我的任务
社区描述
VB 基础类
社区管理员
  • VB基础类社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧