执行以下代码时,提示错误:在应使用条件的上下文(在 'exp' 附近)中指定了非布尔类型的表达式。
Dim exp As String = CExp("[csr] = '{0}' And [tjzt] ={1} and [cszt]= '{2}'", "zzhh" ,1,"待审")
Dim cmd As new SQLCommand
cmd.C
cmd.CommandText= "sel ect username,gzxx,hjszd,lqgxjzy,lqgxcc,tpcl,lqzyym ,cszt From dxxsxxb where exp"
With wb.AddTable("","Table1")
.CreateFromDataTable(cmd.ExecuteReader)
end with
而在SQL窗直接执行:se lect username,gzxx,hjszd,lqgxjzy,lqgxcc,tpcl,lqzyym,cszt From dxxsxxb where [csr]='zzhh' and [tjzt]=1 and [cszt]='待审'
时却能正常显示结果
,是什么原因?谢谢!
补充:[tjzt] 为逻辑型字段,其他为字符型字段
[此贴子已经被作者于2019/5/1 21:39:29编辑过]