老师,我用下面的代码实现了自动选择,这是个通讯录,登录人可以自己新增,表里有一列“提交人“是登录人的名字。还想加个条件,如果是登录人等于表里的提交人则加载,否则不加载,请您指导。'------------------------------任意搜索datatable--------------------------
Dim txt As String = e.Form.Controls("TextBox3").Text
Dim tbl As DataTable = Tables("个人通讯录").DataTable
If txt = "" Then
tbl.loadFilter = ""
Else
txt = "'%" & txt & "%'"
tbl.loadFilter = "单位 Like " & txt & " Or 部门或姓名 Like " & txt
End If
tbl.load
Dim txt As String = e.Form.Controls("TextBox3").Text
Dim tbl As DataTable = DataTables("个人通讯录")
If txt = "" Then
tbl.loadFilter = "登录人='" & user.name & "'"
Else
txt = "'%" & txt & "%'"
tbl.loadFilter = "登录人='" & user.name & "' and (单位 Like " & txt & " Or 部门或姓名 Like " & txt & ")"
End If
tbl.load