“查询”按钮代码:
Dim conStart As WinForm.DateTimePicker = e.Form.Controls("DateTimeStart")
Dim conEnd As WinForm.DateTimePicker = e.Form.Controls("DateTimeEnd")
Dim b As New SQLJoinTableBuilder("查询表1","Sales_Order_Product")
b.C
Tables("Sales_Order_List").Filter = "SubmitDate >= #" & conStart.text & "# And SubmitDate <= #" & conEnd.text & " # And SubmitUser = '" & _UserId & "'"
MessageBox.show(_UserId)
Dim str As String = DataTables("Sales_Order_List").GetComboListString("Id", Tables("Sales_Order_List").Filter).Replace("|", ",")
If str > "" Then
Tables("Sales_Order_Product").Filter = "OrderId In (" & DataTables("Sales_Order_List").GetComboListString("Id", Tables("Sales_Order_List").Filter).Replace("|", ",") & ")"
End If
b.Filter = Tables("Sales_Order_Product").Filter
b.AddTable("Sales_Order_Product","OrderId","Sales_Order_List","Id") '表Sales_Order_Product"和表"OrderId","Sales_Order_List"是关联的
b.AddTable("Sales_Order_List","CustomerId","Customer_List","Id")
b.AddTable("Sales_Order_Product","ProductId","Sales_Product_List","Id")
b.AddCols("{Sales_Product_List}.Name","{Customer_List}.Name","SubmitDate","{Sales_Order_Product}.Amount","{Sales_Order_Product}.SalesPrice","SubmitUserName")
b.Build '生成查询表
Tables("销售查询_Table1").DataSource = b.BuildDataSource()
如果“开始时间”设为2014-01-01,“结束时间”设为2014-01-30,查询表中就会显示出所有的数据,包括其他业务员的订单情况,这是不允许的。
注:数据库表中没有2014年的记录,
此时应该是没有满足的数据记录,应该为空,但是却显示了所有的数据记录,请帮忙解决?谢谢!!!
此主题相关图片如下:1.jpg
[此贴子已经被作者于2014-11-17 15:13:02编辑过]