以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  [原创]  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=145155)

--  作者:johnfelton
--  发布时间:2020/1/9 22:57:00
--  [原创]
从字符串到类型LONG转换无效。

麻烦老师帮看下,下面的代码错在哪里?在SELECT哪里,光一个条件的时候没有问题,加了2个条件,出现这个问题。谢谢

Dim str1 As String = e.Form.Controls("ComboBox4").Value
Dim str As String = e.Form.Controls("ComboBox9").Value
Dim fee As Double
fee = DataTables("stock").Compute("sum(stock_storage)", "batchno = \'" & str & "\'")
Dim qty As Double
qty = DataTables("stock").Compute("sum(stock_qty)", "batchno = \'" & str & "\'")
Dim nms As List(Of DataRow)
nms = DataTables("sales").Select("salesinvoiceno = \'" & str1 & "\'" And "salesbatchno = \'" & str & "\'")
For Each nm As DataRow In nms
    nm("storage") = val(nm("salesqty"))*fee/(qty+val(nm("salesqty")))
    DataTables("stock").ReplaceFor("stock_storage", fee - nm("storage"),"batchno = \'" & str & "\'")
Next
--  作者:johnfelton
--  发布时间:2020/1/9 23:20:00
--  
找到问题,已经解决,谢谢