Click here to Skip to main content
15,897,187 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Would sure appreciate someone pointing me in the right direction: Using VS2013 which has in my error list "The name 'localQBD' does not exist in the current context."

C#
rp.OpenConnection2("", "Sample Code from OSR", localQBD);


When I highlight 'OpenConnection2' and press F12 to Go to Definition, I see:
C#
[DispId(15)]
        void OpenConnection2(string appID, string appName, QBXMLRPConnectionType connPref);


When I highlight QBXMLRPConnectionType and press F12 to Go to Definition, I see:
C#
public enum QBXMLRPConnectionType
    {
        unknown = 0,
        localQBD = 1,
        remoteQBD = 2,
        localQBDLaunchUI = 3,
        remoteQBOE = 4,
    }


How can I diagnose why I am getting the error message?

Thanks--
Posted
Comments
Sergey Alexandrovich Kryukov 4-May-15 17:48pm    
There is nothing to "diagnose", you just don't have this variable or member name.
—SA

You should not do programming, especially such advanced topics as ADO.NET, without reading in language syntax and other basics. I can foresee a lot more problems and frustrations leading you nowhere, unless you properly learn the language.

Perhaps you meant QBXMLRPConnectionType.localQBD, instead of what you have written. :-)

—SA
 
Share this answer
 
v2
Thanks Matt-- Much appreciated.
 
Share this answer
 
Comments
Matt T Heffron 5-May-15 16:13pm    
Suggestion: You should use the "Reply" to respond to comments (like mine), or the "Have a Question or Comment?" to respond to a proposed Solution (like Sergey's). That way we'll get notification of the response. Otherwise, we'll find out only if we happen to recheck the question.
Also, using a "Solution" for replies is very strongly frowned upon as it is seen as an abuse of the Reputation Points system.
Thanks Sergey - yes, thanks: changing the line as follows resolves the problem:

rp.OpenConnection2("", "Sample Code from OSR", QBXMLRPConnectionType.localQBD);


However, this is not my code, it is Intuit's. So it is surprising to me such a change is required to get their code to run, which makes me wonder:

Is there not a way in C# to reference enums without adding such a prefix?
 
Share this answer
 
Comments
Matt T Heffron 5-May-15 13:34pm    
No, there is no way to reference enums without the enumeration type name as the prefix.
However, I'd guess that since this looks like it is sample code (right there in the string!) it isn't intended to be directly usable. Rather, I think it is expected that using this will modify it to approach "your" actual use.

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

  Print Answers RSS
Top Experts
Last 24hrsThis month


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