以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  [求助]sqlselect  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=82409)

--  作者:huhu
--  发布时间:2016/3/17 12:55:00
--  [求助]sqlselect
Dim str As String
Dim id As Integer
id = user.name.IndexOf("@")
str = user.name.SubString(0,id)
Dim lts As List(of DataRow) = DataTables("盖楼").sqlSelect("回复者 like \'%" & str & "%\'  And 备注 Is Not null And 提交 = 0 ")
DataTables("盖楼").SQLUpdate(lts)
msgbox(0)
For Each lt As DataRow In lts
msgbox(1)
    lt("提交") = True
msgbox(2)
    e.Form.Controls("TextBox" & lt("_Identify")).ReadOnly = BooleanEnum.True
    e.Form.Controls("label2" & lt("_Identify")).text = Date.now
msgbox(3)
    lt.save
    lt.Locked = True
Next
DataTables("盖楼").SQLUpdate(lts)
怎么只执行到msgbox(0),for each为什么没执行?

--  作者:大红袍
--  发布时间:2016/3/17 14:29:00
--  

没有进入循环,就是没有查询到数据。修改一下条件试试

 

Dim lts As List(of DataRow) = DataTables("盖楼").sqlSelect("")

msgbox(lts)

msgbox("回复者 like \'%" & str & "%\'  And 备注 Is Not null And 提交 = 0")