以文本方式查看主题

-  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=163356)

--  作者:rgbjwjb
--  发布时间:2021/4/24 18:04:00
--  语句问题
Dim drs As List(of DataRow) = DataTables("低保金发放表").sqlSelect("年度 = \'& cb1.value & \' and 月度 = \'& cb2.value & \'")这个代码有问题吗?请指教,谢谢!
--  作者:有点蓝
--  发布时间:2021/4/25 8:47:00
--  

Dim drs As List(of DataRow) = DataTables("低保金发放表").sqlSelect("年度 = " & cb1.value & " and 月度 = " & cb2.value)

年度和月度如果是字符列,这样
Dim drs As List(of DataRow) = DataTables("低保金发放表").sqlSelect("年度 = \'" & cb1.value & "\' and 月度 = \'" & cb2.value & "\'")