MYSQL使用提取不重复,执行下面代码报错,提示找不到"单号,客户" ,"窗口_Table2"表是有"单号,客户",如何解决?
Dim f As New Filler
f.SourceTable = DataTables("窗口1_Table2") '
f.SourceCols = "单号,客户"
f.DataTable = DataTables("窗口1_Table3") '
f.DataCols = "单号,客户" '
f.Fill() '填充数据
[此贴子已经被作者于2024/2/8 12:37:42编辑过]
Table2、Table3这2个表控件是怎么绑定后台表的?相关代码发上来看看
Table2 、Table3是SQLTable,
Table3是没绑定后台表,就是一个空表,想从Table2提取不重复数据
Table2加载数据
Dim s As String'定义变量为S
s = dr2("Xjry")
Dim db = HySq-l.DataBaseFactory.CreateDatabase("myj")
Dim Sq-l2 = "Selec-t * From 表A as a Inner Join 表B as b On (a.单号 = b.单号) where (b.制单人= '" & _Username & "' or b.UserID in ('" & s.Replace(",", "','") & "')) And (a.审核= '已审核' And a.选中= False) "
Dim dt2 As system.data.DataTable = db.ExecuteDataSet(Sql-2).Tables(0)
Dim t2 As Table = e.Form.Controls("Table2").Table
t2.datasource = dt2.Copy
t2.AllowEdit = True
窗口表如果不做任何绑定,默认都是第一列,第二列这种名称,不可能有
单号,客户这些列
那是不是Table3创建列名称,如第一列为单号,第二列为客户?先创建临时表,给临时表写名字段名后,再执行一楼的代码?
Table3的表类型SQLTable
'创建临时表
Dim dtb As New DataTableBuilder("窗口_Table3")
Dim dtb As New DataTableBuilder("Table3")
dtb.AddDef("订单登记单号", GetType(String), 32)
dtb.AddDef("客户", GetType(String), 50)
dtb.AddDef("客户代号", GetType(String), 32)
执行上面代码,没反应
http://www.foxtable.com/webhelp/topics/1909.htmTables("窗口1_Table1").DataSource =
dtb.BuildDataSource()