以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  请教这段代码怎么写  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=59892)

--  作者:焉子声
--  发布时间:2014/11/13 9:08:00
--  请教这段代码怎么写
如果“成绩表”的“数学”列为空值,则录入“90”,这个代码怎么写?
我写的是:
For Each a As DataRow In DataTables("成绩表").DataRows("数学")
    If a.IsNull=True Then
        a=90
    End If
Next

但是运行错误,请老师指教。谢谢。



--  作者:Bin
--  发布时间:2014/11/13 9:09:00
--  
For Each a As DataRow In DataTables("成绩表").DataRows
    If a.IsNull("数学")=True Then
        a=90
    End If
Next

--  作者:焉子声
--  发布时间:2014/11/13 9:56:00
--  
谢谢,不过还是报错:“类型\'integer\'无法转换为‘datarow\',错误代码a=90"
--  作者:有点甜
--  发布时间:2014/11/13 9:58:00
--  
For Each a As DataRow In DataTables("成绩表").DataRows
    If a.IsNull("数学")=True Then
        a("数学") = 90
    End If
Next

--  作者:焉子声
--  发布时间:2014/11/13 9:58:00
--  
以下是引用Bin在2014-11-13 9:09:00的发言:
For Each a As DataRow In DataTables("成绩表").DataRows
    If a.IsNull("数学")=True Then
        a=90
    End If
Next

谢谢,不过还是报错:“类型\'integer\'无法转换为‘datarow\',错误代码a=90"


--  作者:Bin
--  发布时间:2014/11/13 10:06:00
--  
For Each a As DataRow In DataTables("成绩表").DataRows
    If a.IsNull("数学")=True Then
        a("数学") = 90
    End If
Next

--  作者:焉子声
--  发布时间:2014/11/13 13:57:00
--  
成功,非常感谢。