Jump to content

Error creating a session using the AccpacSession library


Recommended Posts

Hi guys

Sorry if I'm asking about an issue that has already been discussed. I'm using the AccpacSession to create a session in order to write an ArCashBook batch. Here is the code I'm using:

                   session = new AccpacSession();
                    session.Init(model.ObjectHandle, model.AppID, model.ProgramName, model.AppVersion);
                    session.Open(model.UserIdentifier, model.Password, model.Database, model.SessionDateTime, model.Flags, model.Reserved);

                    dbLink = session.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
                    Console.WriteLine("Session and db link created.");

The code is failing on the 2nd line with this error:

 System.Runtime.InteropServices.COMException (0x80004005): Session could not be opened.    at AccpacCOMAPI.IAccpacSession.Open(String UserIdentifier, String Password, String DataBase, DateTime SessionDate, Int32 Flags, String Reserved) 

Can anybody provide some input? Maybe It might be an environment issue? Any help would be appreciated.



Link to comment
Share on other sites

Please sign in to comment

You will be able to leave a comment after signing in

Sign In Now

  • Create New...