I am developing a program in VS 2012, VB.NET. I am using QBSDK v12. I am attempting to open a connection to QB Enterprise 2012, but what happens is that it opens a secondary instance of QB, and then gives me an error message that it can't open two instances at once. If I leave QB closed while trying to connect, I get a message that I need to give it permission first, which requires QB to be open when connecting. I have tried to leave off the company file name, and only connect to the currently open session, but it still opens that secondary window. I have updated QB to the latest and greatest. Nothing seems to help.
Asked
Active
Viewed 555 times
1 Answers
0
The only time I've seen this happen on my side is when I give a specific company file to open that is a different version that the QuickBooks that is currently running. For example, if the file is a QuickBooks 2012 Premier file, but you have QuickBooks 2012 Enterprise open, you'll get this problem.
Here's the code I typically use to connect when I want to open the file that is currently open in QuickBooks:
QBSessionManager SessionManager = null;
try
{
SessionManager = new QBSesionManager();
if(SessionManager == null)
throw new ArgumentNullException("Could not create SessionManager");
SessionManager.OpenConnection2("AppID","CompanyName", ENConnectionType.ctLocalQBD);
SessionManager.BeginSession("", ENOpenMode.omDontCare);
// DO MY QB STUFF
}
catch(Exception ex)
{
MessageBox.Show("Error: " + ex.Message);
}
finally
{
if(SessionManager != null)
{
SessionManager.EndSession();
SessionManager.CloseConnection();
SessionManager = null;
}
}

Hpjchobbes
- 1,309
- 1
- 8
- 11