如何使用Quickbooks QBXML获取客户详细信息

时间:2013-07-22 09:37:21

标签: quickbooks qbfc

我使用的是QuickBooks API。通过此API,我尝试获取所有客户详细信息,如FullName,Addresses(Addr1,Addr2 ....),City,State,PostalCode等。

以下是我的代码:

RequestProcessor2Class rp = new RequestProcessor2Class();


public void connectToQB()
        {
            rp = new RequestProcessor2Class();
            rp.OpenConnection(appID, appName);
            ticket = rp.BeginSession(companyFile, mode);
            string[] versions = rp.get_QBXMLVersionsForSession(ticket);
            maxVersion = versions[versions.Length - 1];
        }

public string processRequestFromQB(string request)
        {
            try
            {
                return rp.ProcessRequest(ticket, request);
            }
            catch (Exception e)
            {
                MessageBox.Show(e.Message);
                return null;
            }
        }


string request = "CustomerQueryRq";
            objConnect.connectToQB();
            int count = objConnect.getCount(request);
            string response = objConnect.processRequestFromQB(objConnect.buildCustomerQueryRqXML(new string[] { "FullName", "City" }, null));
            string[] customerList = objConnect.parseCustomerQueryRs(response, count);
            objConnect.disconnectFromQB();

如果您想了解更多信息,请与我们联系。

谢谢,

1 个答案:

答案 0 :(得分:0)

这是获取客户名称的示例代码。

   ICustomerRetList customerRetList = (ICustomerRetList)response.Detail;
   ICustomerRet customerRet = customerRetList.GetAt(0);
   textBox1.Text = customerRet.Name.GetValue().ToString();

请了解更多信息。

- >>获取其他细节。