以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  这个fill怎么只返回最后一条记录?要怎么才能全部显示?  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=185160)

--  作者:hitzfeld
--  发布时间:2023/2/7 23:29:00
--  这个fill怎么只返回最后一条记录?要怎么才能全部显示?
Dim x As String = e.Form.Controls("textbox23").Text 
Dim drs As List(Of DataRow) = DataTables("出库明细").SQ/Select("单号 = \'" & x & "\'", "", "出库日期 ")
For Each dr5 As DataRow In drs
If dr5 IsNot Nothing Then
Tables("查询_table4").Fill("Se/ect * Fr om {出库单} Where [出库单号] = \'" & dr5("出库单号") & "\'", "xxxx", False)

msgbox(dr5("出库单号"))
Next

End If

这里的出库单号有三条记录,msgbox返回的也是三条,但是fill只有最后一条。感觉是前两条被覆盖了?要怎么才能在Tables("查询_table4")显示全部记录?



--  作者:cd_tdh
--  发布时间:2023/2/8 8:30:00
--  
不是fill问题,是你msgbox问题。
--  作者:有点蓝
--  发布时间:2023/2/8 8:37:00
--  
Dim x As String = e.Form.Controls("textbox23").Text 
Tables("查询_table4").Fill("S
elect * From {出库单} Where [出库单号] in (select 出库单号 from 出库明细 where 单号 = \'" & x & "\')", "xxxx", False)
--  作者:hitzfeld
--  发布时间:2023/2/8 15:08:00
--  
蓝老师,在您的指导下,我终于得到了希望的结果,但是在调试的时候,发现这个fill的结果不能排序?不管怎么改都是按日期升序排列?

Dim x As String = e.Form.Controls("textbox23").Text 
Dim drs As List(Of DataRow) = DataTables("出库明细").SQ/Select("单号 = \'" & x & "\'", "", "出库日期 DESC")
Dim drs As List(Of DataRow) = DataTables("出库明细").SQLSe/ect("工作单号 = \'" & x & "\'", "", "出库日期 DESC")
For Each dr5 As DataRow In drs
If dr5 IsNot Nothing Then
Tables("查询_table4").Fill("Select * Fr om {出库单} Where [出库单号] in (se/ect 出库单号 fr om 出库明细 where 单号 = \'" & x & "\') ORDER BY 出库日期 DESC", "packaging", False)
End If
Next

--  作者:有点蓝
--  发布时间:2023/2/8 15:16:00
--  
Tables("查询_table4").Fill(.....
Tables("查询_table4").sort = “某某列”


--  作者:有点蓝
--  发布时间:2023/2/8 15:17:00
--  
3楼2句代码就够了,4楼的其它代码,和循环完全是多余的
--  作者:hitzfeld
--  发布时间:2023/2/8 15:23:00
--  
学生愚钝,谢谢蓝老师的耐心指导!感恩!图片点击可在新窗口打开查看