--
可以了,老师我还有一个问题,就是如果我改成数据增加一条要这么修改代码呢。配合扫码枪,扫一下就表控件里面增加物料名称列和数量,比如57019,10 10是数量
Dim Filter As String
filter = " where a.finterid > 0 "
With e.Form.Controls("物料名称")
If .Value IsNot Nothing Then
Filter = Filter & " and d.fitemid = \'" & .Value & "\'"
End If
End With
Dim cmd As New SQLCommand
Dim dt As DataTable
Dim cmb As WinF orm.Com boBox
cmd.ConnectionN ame = "ceshi"
cmd.CommandText = "SEL E CT top 2000 a.fbillno as 单据编号,d.fname as 物料名称 " & _
" From POOrder a left join POOrderentry b on a.finterid = b.finterid " & _
" left join t_ICItem d on b.fitemid = d.fitemid " & filter
dt = cmd.ExecuteReader() \'SQL语句拼接表格
Tables("窗口1_Table1").DataSource = dt
Tables("窗口1_Table1").AutoSizeCols() \'自动列宽
[此贴子已经被作者于2019/11/18 11:32:29编辑过]