小编Kod*_*ody的帖子

访问COM组件时出错

我为Microsoft Office Word构建了一个加载项.当Word以管理员身份运行时使用加载项没有问题,但是当它不以管理员身份运行时,访问功能区元素有两个常见的例外.

第一个例外:

Unable to cast COM object of type 'System.__ComObject' to interface type 'Microsoft.Office.Core.IRibbonUI'. This operation failed because the QueryInterface call on the COM component for the interface with IID '{000C03A7-0000-0000-C000-000000000046}' failed due to the following error:  could not be found. (Exception from HRESULT: 0x80030002 (STG_E_FILENOTFOUND)).
   at Microsoft.Office.Core.IRibbonUI.InvalidateControl(String ControlID)
Run Code Online (Sandbox Code Playgroud)

通过以下代码使控件无效时,会发生此错误:

ribbon.InvalidateControl("control-id");
Run Code Online (Sandbox Code Playgroud)

第二个例外:

Unable to cast COM object of type 'Microsoft.Office.Interop.Word.ApplicationClass' to interface type 'Microsoft.Office.Interop.Word._Application'. This operation failed because the QueryInterface call on the COM component for the interface …
Run Code Online (Sandbox Code Playgroud)

c# com office-2007 ms-word

29
推荐指数
2
解决办法
5万
查看次数

如何将DataTable(或类似)与Oracle DB一起使用

我最近一直在处理一些性能问题,并试图找出如何以指数方式提高某些Oracle数据库调用的性能.

技术:

我熟悉DataTableDapper和SQL Server 的使用和表值参数,并希望使用上述技术复制它.我还没有能够重现下面的解决方案来使用Devart和OracleManaged:

下面的代码不是我正在运行的......这是一个释义的例子.我只需要与Oracle一起工作的东西来传递DataTable或在查询/插入中使用的对象数组.

SQL Server:

CREATE TYPE MyCustomerInfo AS TABLE
(
    Id BIGINT NOT NULL,
    --Name NVARCHAR(32) NOT NULL,
    --...
);
Run Code Online (Sandbox Code Playgroud)

C#for SQL Server:

const string getCustomersSql = @"
    SELECT
        c.Id,
        --c.Name
        --...
    FROM @myCustomers mc
    LEFT JOIN Customers c
        ON c.Id = mc.Id";

var myCustomers = new DataTable();
myCustomers.Columns.Add("Id", typeof(long));
//...

myCustomers.Rows.Add(1);
myCustomers.Rows.Add(2);

var customers = await sqlDbConnection.QueryAsync<Customer>(getCustomersSql, new { myCustomers = myCustomers.AsTableValuedParameter("MyCustomerInfo") }); …
Run Code Online (Sandbox Code Playgroud)

c# devart dapper oracledb .net-core-2.0

6
推荐指数
1
解决办法
508
查看次数

标签 统计

c# ×2

.net-core-2.0 ×1

com ×1

dapper ×1

devart ×1

ms-word ×1

office-2007 ×1

oracledb ×1