Click here to Skip to main content
15,890,579 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I need to connect to QuickBooks Enterprise 2003 and the following code does not accept majorVer as 2.1 which support usin AppendInvoiceModRq and AppendDataExtModRq so i tried to change majorVer to 2.1
after that i have error (It must be cannot convert from 'double' to 'short') my problem that majorVer 2 not support what i want to do but quickbooks 2003 SupportedQBXMLVersion v 2.1 that's code to connect
private static void OpenConnection(short majorVer,short minorVer,string companyPath) {
        SessionManager=new QBSessionManager();
        //Create the message set request object to hold our request.
        RequestMsgSet=SessionManager.CreateMsgSetRequest("US",majorVer,minorVer);
        RequestMsgSet.Attributes.OnError=ENRqOnError.roeContinue;
        //Connect to QuickBooks and begin a session
        SessionManager.OpenConnection("","Open Dental");
        ConnectionOpen=true;
        SessionManager.BeginSession(companyPath,ENOpenMode.omDontCare);
        SessionBegun=true;
    }



Any help is highly appreciated

i try to doing update to invoice using this code
public void updateInvoice(string invoNumber)
       {
           OpenConnection();
           majorVersionQB = Convert.ToInt16(QBFCLatestVersion(sessionManager));
           requestMsgSet = getLatestMsgSetRequest(sessionManager);

           requestMsgSet = sessionManager.CreateMsgSetRequest(countryQB, majorVersionQB, minorVersionQB);
           requestMsgSet.Attributes.OnError = ENRqOnError.roeContinue;

           IInvoiceQuery InvoiceQueryRq = requestMsgSet.AppendInvoiceQueryRq();
           InvoiceQueryRq.ORInvoiceQuery.RefNumberList.Add(invoNumber);
           InvoiceQueryRq.OwnerIDList.Add("0");
           InvoiceQueryRq.IncludeLineItems.SetValue(true);
           InvoiceQueryRq.IncludeLinkedTxns.SetValue(true);


           IInvoiceMod updateInvoiceModRq = requestMsgSet.AppendInvoiceModRq();

               updateInvoiceModRq.Other.SetValue("hi");
               updateInvoiceModRq.EditSequence.SetValue("1640351207");


               IMsgSetResponse responseMsgSet = sessionManager.DoRequests(requestMsgSet);

               IResponse response = responseMsgSet.ResponseList.GetAt(0);


           CloseConnection();







       }


i got error
System.Runtime.InteropServices.COMException: 'This request is not supported in the specified qbXML version.'


What I have tried:

I need to connect to QuickBooks Enterprise 2003
Posted
Updated 24-Dec-21 6:23am
v2
Comments
CHill60 23-Dec-21 11:30am    
Which line is throwing that exception?
michael nabil 23-Dec-21 11:34am    
RequestMsgSet=SessionManager.CreateMsgSetRequest("US",majorVer,minorVer)
This line if you change majorver to 2.1
Richard MacCutchan 23-Dec-21 11:55am    
You cannot put 2.1 into majorVer, it is a short type which only accepts integers. You should use 2 for majorVer, and 1 for minorVer.
michael nabil 23-Dec-21 12:01pm    
I need to use 2.1
Buz SupportedQBXMLVersion v 2.1 can use AppendDataExtModRq
And i don’t know why quick books use type short when it use 2.1 as double
Richard MacCutchan 23-Dec-21 12:03pm    
As I already explained, you cannot use 2.1, it is not a valid integer type.

1 solution

You cannot pass majorVer as "2.1" - CreateMsgSetRequest is expecting a short value - i.e. an integer between -32,768 to 32,767

Try
C#
RequestMsgSet=SessionManager.CreateMsgSetRequest("US",2,1);
or pass in majorVer = 2 and minorVer = 1
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900