以下是引用bagabaga在2014-7-25 21:53:00的发言:
Dim 年,月 As Integer
Dim dt As DataTable
Dim cmd As New SQLCommand
cmd.Connec 到外部数据源
cmd.CommandText = "SELECT Year(日期) As 年,Month(日期) As 月,类目,科目,项目名称,收入,支出,支出,iif(收入 is null, 0, 收入)-iif(支出 is null, 0, 支出) As 合计 From {记账} where not(科目 ='理财')"
dt = cmd.ExecuteReader()
For Each r As DataRow In dt.DataRows
Output.Show(r("合计") & "," & r("收入") & "," & r("支出") )
Next
是外部数据源,怎么改写
是语法错误吗?如果是的,把iif换成case when试试。