C# 3.0 检索CLSID为{}的组件的COM类工厂时出错

C# 3.0 检索CLSID为{}的组件的COM类工厂时出错,c#-3.0,quickbooks,C# 3.0,Quickbooks,当我想通过c#在quick book上添加新客户时,出现以下错误: 由于以下错误,检索CLSID为{178AACCA-9DCE-42A0-A193-CF4985B930E5}的组件的COM类工厂失败:80040154。 这是我发现错误的代码。。 请写下有效的答案。。。谢谢 try { //Create the session Manager object sessionManager = new QBSessionM

当我想通过c#在quick book上添加新客户时,出现以下错误: 由于以下错误,检索CLSID为{178AACCA-9DCE-42A0-A193-CF4985B930E5}的组件的COM类工厂失败:80040154。

这是我发现错误的代码。。 请写下有效的答案。。。谢谢

       try
        {

            //Create the session Manager object
            sessionManager = new QBSessionManager();

            //Create the message set request object to hold our request  
            IMsgSetRequest requestMsgSet = sessionManager.CreateMsgSetRequest("US", 8, 0);
            requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

            //Connect to QuickBooks and begin a session
            sessionManager.OpenConnection("App1", "QuickBooks");
            connectionOpen = true;
            sessionManager.BeginSession(@"C:\Users\Public\Documents\Intuit\QuickBooks\Company Files\PSNew.QBW", ENOpenMode.omDontCare);
            sessionBegun = true;

            ICustomerAdd customerAddRq = requestMsgSet.AppendCustomerAddRq();
            customerAddRq.Name.SetValue(CP.CustomerName);
            customerAddRq.LastName.SetValue(CP.CustomerLastName);
            customerAddRq.Email.SetValue(CP.CustomerEmail);

            //Send the request and get the response from QuickBooks
            IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);
            IResponse response = responseMsgSet.ResponseList.GetAt(0);
            ICustomerRet customerRet = (ICustomerRet)response.Detail;

            CP.GetCustomerId = customerRet.ListID.GetValue();
            CP.GetCustomerName = customerRet.Name.GetValue();
            CP.GetCustomerEmail = customerRet.Email.GetValue();
            //CP.customerAddRq1 = customerAddRq.Name.GetValue();
        }

        catch (Exception)
        {
            throw;
        }
        finally
        {
            //End the session and close the connection to QuickBooks
            if (sessionBegun)
            {
                sessionManager.EndSession();
            }

            if (connectionOpen)
            {
                sessionManager.CloseConnection();

            }

确保在编译应用程序时,将目标平台的project build Configuration设置为x86。鉴于Intuit integration DLL为32位,这是网络上最常见的解决方案。然而,在我遇到这个问题时,我决定将QuickBooks SDK安装到客户机上,并成功地解决了这个问题。

谢谢您的建议。。我在另一台电脑上用同样的方法找到了解决方案。我的问题可能是操作系统支持问题。。它正在窗口7上工作,但尚未在窗口8上工作。。。