以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [求助] 改成SQL  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=164294)

--  作者:sanny
--  发布时间:2021/5/5 9:35:00
--  [求助] 改成SQL


老师,以下代码在表属性中,如何用黄色代码来取代,因为表SDBC_Sq在服务器上,谢谢。



If e.DataCol.Name = "BatchNo" Then
    Dim sum As Double= 0
   For Each dr1 As DataRow In DataTables("SDBC_Sq").Se lect("BatchNo=\'" & e.NewValue & "\'")
    
        sum += dr1("IncomingQty")
    Next
    e.DataRow("QCQty") = sum
End If



Dim cmd As new SQLCommand
cmd.Con necti
Dim dt As DataTable

--  作者:有点蓝
--  发布时间:2021/5/5 9:41:00
--  

If e.DataCol.Name = "BatchNo" Then
    e.DataRow("QCQty") = DataTables("SDBC_Sq").SQLCompute("sum(IncomingQty)","BatchNo=\'" & e.NewValue & "\'")
End If