0

I am trying to open session and add some records to QB, but it does not seem to do anything and does not open session.

Code:

QBFC13Lib.QBSessionManager sessionManager = new QBFC13Lib.QBSessionManager();
//or 
QBSessionManager sessionManager = new QBSessionManager();

I tried both.

Installed QBSDK13 and added reference Interop.QBFC13 and namespace QBFC13.

No success so far. Please help me with some examples or advice. Thanks.

Will
  • 24,082
  • 14
  • 97
  • 108
DevSrb
  • 17
  • 4

2 Answers2

0

Just creating a new session manager does not make a connection to QuickBooks or a QuickBooks data file. You need to call OpenConnection2 and BeginSession on the QBSessionManager object.

QBSessionManager sessionMananger = new QBSessionManager();
sessionMananger.OpenConnection2("AppID", "AppName", ENConnectionType.ctLocalQBD);
sessionMananger.BeginSession("QBFile", ENOpenMode.omDontCare);

You'll want to replace AppID and AppName with string values for your app. This is what gets presented to the QB User to grant access. The QBFile string is the file that you want to open. Leave this as a blank string to start a session with the currently opened QB file. If QuickBooks is not currently running or logged into a file, you must supply the file name.

The QBSDK Programmer's Guide that gets installed when you install the SDK has all this information. The connection information starts on page 45.

Hpjchobbes
  • 1,309
  • 1
  • 8
  • 11
0

I was also getting errors with the session manager. Make sure your are building against x86. The COM libraries are 32-bit.

ShooShoSha
  • 956
  • 10
  • 17