Dim Book As New XLS.Book("C:\施耐德订单.xls")
Dim Sheet As XLS.Sheet = Book.Sheets(0)
Tables("销售单").StopRedraw()
Dim nms() As String = {"", "", "", "销售单号", "销售单行号", "产品代号", "", "", "销售数量", "要求交货日期", "", "", "", "", "", ""}
For n As Integer = 1 To Sheet.Rows.Count - 1
'msgbox(1)
Dim xsdh As String = sheet(n, 3).Text '销售单号
Dim xsdhh As String = sheet(n, 4).Text '销售单行号
Dim xsdhh1 As Integer = CInt(xsdhh) '销售单行号
Dim cpdh As String = sheet(n, 5).Text '产品代号
Dim xssl As String = sheet(n, 8).Text '销售数量
Dim xssl2 As Integer = CInt(xssl) '销售数量
Dim jhrq As Date '要求交货日期
If Date.TryParse(sheet(n, 9).Text, jhrq) = False Then
output.show("日期值无法转换")
End If
'msgbox(2)
Dim drd As DataRow = DataTables("物料字典").SQLFind("物料编号 = '" & cpdh & "'") '2025/4/1 更改
If drd IsNot Nothing Then
'msgbox(3)
'If drd("细分一") <> "侧盖板组件" Then '2025/4/1 取消
Dim dr As DataRow = DataTables("销售单").SQLFind("销售单号 = '" & xsdh & "' And 销售单行号 = '" & xsdhh1 & "'")
If dr IsNot Nothing Then
Else
Dim dr1 As DataRow = DataTables("销售单").AddNew()
dr1("销售单号") = xsdh
dr1("销售单行号") = xsdhh1
dr1("客户代号") = "CS0001"
dr1("产品代号") = cpdh
dr1("要求交货日期") = jhrq
dr1("销售数量") = xssl2
dr1.save
End If
'End If
End If
Next
Tables("销售单").ResumeRedraw()
Tables("销售单").save
老师,我上面那个按钮里面的代码,总是出现 从字符 “” 串到 “Integer” 的转换无效,输入字符串的格式不正确 这个提示。请问是哪里的问题呢?谢谢。
比如销售数量这种没有数据下面代码就会出错
Dim xssl2 As Integer = CInt(xssl) '销售数量
可以改为
Dim xssl2 As Integer = 0
integer.TryParse(xssl,xssl2 )