以文本方式查看主题 - Foxtable(狐表) (http://www.foxtable.com/bbs/index.asp) -- 专家坐堂 (http://www.foxtable.com/bbs/list.asp?boardid=2) ---- [求助]sql返回值出错 (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=179684) |
-- 作者:2425004926 -- 发布时间:2022/9/3 13:16:00 -- [求助]sql返回值出错 老师指点一下,实在查不出哪里问题?DateVisit是日期型列 Dim d As Date = Date.Today dim Val06 as integer f = "[DateVisit] >= \'" & d & "\' and [DateVisit] < \'" &
d.AddDays(1) & "\' and [Possessor] = \'" & P & "\'" 加载表统计行数OK Val06 = DataTables("UserVisit").SQLCompute("Count(*)", f)以下统计行数,不加载表,出错:列名 \'DateVisit\' 无效。 Dim cmd As New SQLCommand cmd.CommandText = "Select Count(*) Fr om {UserVisit} Where " & fcmd.C Val06 = cmd.ExecuteScalar() 我又作了判断,还是同样的问题,出错:列名 \'DateVisit\' 无效。 dim Val as integer val = cmd.ExecuteScalar()
If val.ToString <> Nothing Then ’这个是否一定要作判断 Val06 = val End If |
-- 作者:2425004926 -- 发布时间:2022/9/3 13:38:00 -- 我一段一段关闭再测试,又好了,我都不知怎么好的,哈哈 |
-- 作者:有点蓝 -- 发布时间:2022/9/3 13:56:00 -- http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&Id=179683这个帮助是判断ExecuteValues的返回值的,和ExecuteScalar没有一分钱的关系,不要乱套 |