老师,你好! 以下代码是从SQL 数据库中下载所有的资料,但是一下载又太多了,可不可以针对以下黄色的帮忙加个条件,这个条件是根据当前窗口表中所选的生产任务单号作为条件,如图。只下载所选单号的记录呢。谢谢。
Dim cmd As New SQLCommand
Dim dte As DataTable
DataTables("生产投料单").datarows.clear
cmd.C
Dim Cols1s() As String = {"FBillNo","FNumber","FName","FName1","FAuxQtyPick"}
Dim Cols2s() As String = {"生产任务单号","物料代码","物料名称","单位","应发数量"}
cmd.CommandText = "Sel ect {ICMO}.FBillNo,{PPBOM}.FBillNo,{PPBOM}.FStatus,FAuxQtyPick,{t_Item}.*,{t_UnitGroup}.FName From (((({PPBOMEntry} Inner JOIN {PPBOM} ON {PPBOM}.[FInterID] = {PPBOMEntry}.[FInterID]) Inner JOIN {t_Item} ON {t_Item}.[FItemID] = {PPBOMEntry}.[FItemID]) Inner JOIN {ICMO} ON {ICMO}.[FInterID] = {PPBOM}.[FICMOInterID]) Inner JOIN {t_ICItemBase} ON {t_ICItemBase}.[FItemID] = {t_Item}.[FItemID]) Inner JOIN {t_UnitGroup} ON {t_UnitGroup}.[FUnitGroupID] = {t_ICItemBase}.[FUnitGroupID] Where {PPBOM}.[fstatus] <> 1"
dte = cmd.ExecuteReader()
For Each dr1 As DataRow In dte.DataRows
Dim dr2 As DataRow = DataTables("生产投料单").AddNew()
For i As Integer = 0 To Cols1s.Length -1
dr2(Cols2s(i)) = dr1(Cols1s(i))
Next
Next
Tables("生产投料单").ResumeRedraw()
DataTables.save
此主题相关图片如下:捕获.jpg