Dim s2 As String = DataTables("用户资料").DataCols("合计金额").Expression
Dim s3 As String = DataTables("用户资料").DataCols("到期时间").Expression
DataTables("用户资料").DataCols("合计金额").Expression = ""
DataTables("用户资料").DataCols("到期时间").Expression = ""
DataTables("用户交费记录").LoadFilter = "用户账号 In (" & ids & ")"
DataTables("用户交费记录").Load()
DataTables("用户资料").DataCols("合计金额").Expression = s2
DataTables("用户资料").DataCols("到期时间").Expression = s3
另外,感觉这个查询里的加载完全没有必要啊,每次都是加载全部的数据,没看出来有什么意义。要的效果不应该是只加载符合条件的数据吗?那么应该这样:
Dim s As WinForm.ComboBox = e.Form.Controls("cxfs")
Dim cx As WinForm.TextBox = e.Form.Controls("srcx")
Dim filter As String = ""
Select Case s.Text
Case "姓名查找"
filter = "用户名称 like '%" & cx.text & "%'"
Case "账号查找"
filter = "用户账号 Like '%" & cx.text & "%' "
Case "号线查找"
filter= "号线地址 Like '%" & cx.text & "%'"
Case "手机查找"
filter = "号码1 like '%" & cx.text & "%' or 号码2 like '%" & cx.text & "%' or 号码3 like '%" & cx.text & "%' "'
Case "地址查找"
filter = "装机地址 Like '%" & cx.text & "%'"
Case Else
MessageBox.Show("未查到数据")
Return
End Select
DataTables("用户资料").LoadFilter = filter
DataTables("用户资料").Load
Dim ids As String = ""
For Each dr As DataRow In DataTables("用户资料").DataRows
ids = ids & ",'" & dr("用户账号") & "'"
Next
If ids > ""
ids= ids.Trim(",")
DataTables("用户交费记录").LoadFilter = "用户账号 In (" & ids & ")"
Else
DataTables("用户交费记录").LoadFilter = "false"
End If
DataTables("用户交费记录").Load()