以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  Retrieving the COM class factory for component with CLSID 错误的处理  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=189232)

--  作者:creastzh
--  发布时间:2023/11/18 5:48:00
--  Retrieving the COM class factory for component with CLSID 错误的处理
不知道这个问题发生的原因是什么? 此前运行基本正常, 现在偶尔发生一次. 谢谢!
 
.NET Framework 版本:4.0.30319.42000
Foxtable 版本:2022.8.18.1
错误所在事件:自定义函数,ImportGDPErrorList
详细错误信息:
Exception has been thrown by the target of an invocation.
Retrieving the COM class factory for component with CLSID {00024500-0000-0000-C000-000000000046} failed due to the following error: 80080005 Server execution failed (Exception from HRESULT: 0x80080005 (CO_E_SERVER_EXEC_FAILURE)).


--  作者:有点蓝
--  发布时间:2023/11/18 8:58:00
--  
函数代码发上来看看啊。提示com组件找不到,可能和其它软件有冲突,或者系统被破坏了
--  作者:creastzh
--  发布时间:2023/11/18 16:04:00
--  
这个问题并不是一直出现, 有时候出现,刚才我又执行了一次,正常运行了. 

下面是程序段:
\'ImportGDPErrorList  导入GDP Error List.xlsx

Dim s1 As Date = Date.Now
Dim s2 As Date 
Dim s3 As TimeSpan
Dim cg As Boolean = True

Dim TableN As String = "GDPList"
Dim yn As Integer 
If Not DataTables.Contains(TableN) Then
    yn = 1
    DataTables.Load(TableN)
    DataTables(TableN).LoadFilter = ""
    DataTables(TableN).Load
End If 
Tables(TableN).StopRedraw \'停止屏幕刷新

Dim fp As String = "P:\\General documents\\Worktime Data\\Fox Data\\Query\\"
Dim ff = "GDP Error List.xlsx"
Dim fpf As String = fp & ff

If filesys.FileExists(fpf) Then
    Dim cn As String \'列名称
    Dim i As Integer
    Dim App As New MSExcel.Application
    App.DisplayAlerts = False
    App.visible = True
    Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open(fpf)
    Wb.RefreshAll
    \'MessageBox.Show(1)
    Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1)
    Dim Rg As MSExcel.Range = Ws.UsedRange
    Dim ary = Rg.value
    Dim cs As Integer = Rg.Columns.Count
    Dim c As Integer
    Dim Dic_Ex As New Dictionary(Of DataRow, Integer)
    cs = 13
    Dim i1 As Integer = 0
    Dim Filter As String 
    For i = 2 To Rg.Rows.Count
        \'MessageBox.Show(i & "/" & Rg.Rows.Count & ", 姓名:" & ary(i,3))
        If ary(i, 3) > "" Then \'姓名\'AndAlso ary(i, 3) = "姓名"
            Filter = "[Date]=# " & ary(i, 1) & "# and [姓名]=\'" & ary(I, 3).trim & "\' and [工单号] = \'" & ary(i, 5).trim & "\' and [问题描述]=\'" & ary(i, 8).trim & "\'"
            \'Output.Show(Filter)                    
            Dim dr As DataRow = DataTables(TableN).Find(Filter) 
            If dr Is Nothing Then \'新增数据行                
                Dim ro As DataRow = DataTables(TableN).AddNew 
                For c = 1 To cs
                    cn = ary(1, c) \'列名
                    \'Output.Show(cn & ":" & ary(i,c))
                    ro(cn) = ary(i, c)
                Next
                i1 = i1 + 1 
            End If
        End If
    Next
    
    Tables(TableN).ResumeRedraw \'停止屏幕刷新
    If i1 > 0 Then 
        DataTables(TableN).Save
    End If
    If yn = 1 Then DataTables.Unload(TableN)
    App.quit
End If


s2 = Date.Now
S3 = s2 - s1
Output.Show(s1 & " -- " & s2 & "  文件ImportGDPErrorList刷新经过时间s:" & s3.TotalSeconds)
Dim dr1 As DataRow = DataTables("Data").Find("文件更新_文件名 = \'" & ff & "\'")
dr1("文件更新_时间") = Date.Now
dr1("SpentTime") = Round2(s3.TotalSeconds, 2)
dr1.Save
[此贴子已经被作者于2023/11/18 16:05:12编辑过]

--  作者:有点蓝
--  发布时间:2023/11/18 17:23:00
--  
可能是文件读取冲突。比如多个程序同时读取同一个文件。或者是在计划中,计划间隔小,第一次处理还没有完毕,又启动了第二次。或者是文件处于打开状态
--  作者:creastzh
--  发布时间:2023/11/20 11:05:00
--  
可能是这个问题,这两天的测试中间出过1次同样的问题,其它时间都正常