在开发版软件上运行正常,但是发布的项目运行导入excel的程序时出错,请各位老师帮助指教,谢谢!!
按钮代码如下:
Dim Book As New XLS.Book(ProjectPath & "银行账户.xls")
If DataTables("银行账户").Find("年月 = '" & ny & "'") IsNot Nothing Then
messagebox.show("当月数据已导入","提示")
Return
End If
Dim id As Integer = -1
If DataTables("银行账户").DataRows.Count > 0 Then
id = DataTables("银行账户").Compute("Max([_Identify])")
End If
For i As Integer = 0 To Book.Sheets.Count -1
Dim a As String = Book.Sheets(i).Name
If a = ny Then
Dim mg As New Merger
mg.SourcePath = ProjectPath & "银行账户.xls"
mg.Format = "excel" '指定格式
mg.SourceTableName = "" & ny &"$" '指定要合并的表
mg.DataTableName = "银行账户" '指定接收数据的表
mg.Merge() '开始合并
For Each dr As DataRow In DataTables("银行账户").DataRows
If dr.IsNull("年月") Then
dr("年月") = ny
End If
Next
Tables("银行账户").AutoSizeCols()
DataTables("银行账户").Save()
Return
End If
Next
Messagebox.show("需导入的数据不存在!","提示")
需导入的excel文件放在项目的根目录下。

此主题相关图片如下:b.png
[此贴子已经被作者于2011-12-27 13:01:00编辑过]