Error opening ACCPACXAPILib.xapiSession in VB.NET
Error opening ACCPACXAPILib.xapiSession in VB.NET
(OP)
Hi
I receive an error when i try to open the 'ACCPACXAPILib.xapiSession' object in VB.Net web project.
My code is as follows:
Dim Session As ACCPACXAPILib.xapiSession
Session = New ACCPACXAPILib.xapiSession
Session.Open("ADMIN", "ADMIN", "RMICON", Now.Today, 0)
The code crashes on the last line of code and returns the following error:
Unspecified error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Unspecified error
Source Error:
Line 92: Dim Session As ACCPACXAPILib.xapiSession
Line 93: Session = New ACCPACXAPILib.xapiSession
Line 94: Session.Open("ADMIN", "ADMIN", "RMICON", Now.Today, 0)
Line 95:
Line 96: ARCUSTOMER = Session.OpenView("AR0024", "AR")
Source File: c:\inetpub\wwwroot\RMIWeb\ucContact.ascx.vb Line: 94
Stack Trace:
[COMException (0x80004005): Unspecified error]
ACCPACXAPILib.xapiSessionClass.Open(String UserIdentifier, String Password, String DataBase, DateTime SessionDate, Int32 Flags) +0
RMIWeb.ucContact.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\RMIWeb\ucContact.ascx.vb:94
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
I receive an error when i try to open the 'ACCPACXAPILib.xapiSession' object in VB.Net web project.
My code is as follows:
Dim Session As ACCPACXAPILib.xapiSession
Session = New ACCPACXAPILib.xapiSession
Session.Open("ADMIN", "ADMIN", "RMICON", Now.Today, 0)
The code crashes on the last line of code and returns the following error:
Unspecified error
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Unspecified error
Source Error:
Line 92: Dim Session As ACCPACXAPILib.xapiSession
Line 93: Session = New ACCPACXAPILib.xapiSession
Line 94: Session.Open("ADMIN", "ADMIN", "RMICON", Now.Today, 0)
Line 95:
Line 96: ARCUSTOMER = Session.OpenView("AR0024", "AR")
Source File: c:\inetpub\wwwroot\RMIWeb\ucContact.ascx.vb Line: 94
Stack Trace:
[COMException (0x80004005): Unspecified error]
ACCPACXAPILib.xapiSessionClass.Open(String UserIdentifier, String Password, String DataBase, DateTime SessionDate, Int32 Flags) +0
RMIWeb.ucContact.Page_Load(Object sender, EventArgs e) in c:\inetpub\wwwroot\RMIWeb\ucContact.ascx.vb:94
System.Web.UI.Control.OnLoad(EventArgs e)
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Control.LoadRecursive()
System.Web.UI.Page.ProcessRequestMain()
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
Dim Session As ACCPACXAPILib.xapiSession
Set Session = CreateObject("ACCPAC.xapisession")
Session.Open "ADMIN", "ADMIN", "RMICON", Date, 0
The 'Date' is the /VB6 'Date' function that will return a date in the format '10/08/2003' (your computer's short date). I am not sure what the .net 'Now.Today' will return so just make sure that a correct date value is being returned.
Thanks and Good Luck!
zemp
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
Where does AccPac check to see that I am using the correct Username and Password?
Where does AccPac store the database Id (RMICON) that I am passing into the variable?
Perhaps the problem lies with that?
A post I read somewhere suggested that problems could be caused by the 'Plususer.ini' file being incorrect.
The only thing in my file is:
[options]
default macro=C:\Program Files\ACCPAC\MACROS\MACRO01.AVB
default macro type=VBA
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
You can check the database ID that you need to use by opening ACCPAC and Checking the 'Database ID' in Common services/company profile. Also double check the user name and password.
The xAPI uses the system manager to connect to the ACCPAC data. If the system manager can get in then usually the xAPI can.
Thanks and Good Luck!
zemp
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
I just quickly tried the following code in a VB .NET Windows Application project:
Dim session As New ACCPACXAPILib.xapiSession()
session.Open("ADMIN", "ADMIN", "SAMINC", Now.Today, 0)
MsgBox(session.Company.Name)
I've got my "Sample Company Inc." in a message box without a problem.
I added a reference to XAPI library through Project -> Add Reference -> COM -> ACCPACXAPI 1.1 Type Library prior to start coding.
------------------------
rvspy@nospam.hotmai1.com
(remove nospam and change 1 to L)
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
I have been trying to do this with version 5.1A, Has annybody tried this with version 6, or know if it is posisble?
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
Q: Is the ACCPAC xAPI 1.1 Type Library (a4wcomm.dll)compatible with VB.Net or must we stay with VB6?
A: No, it's not. ACCPAC 5.1 service pack 2 or later got its own .NET libraries...
Thanks and Good Luck!
zemp
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
BTW, Zemp what this "other" forum? Are you referring to a certain JC person?
------------------------
rvspy@nospam.hotmai1.com
(remove nospam and change 1 to L)
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
BTW, Zemp what this "other" forum? Are you referring to a certain JC person?
Thanks everyone! I am learning new things from this forum everytime I visit.
------------------------
rvspy@nospam.hotmai1.com
(remove nospam and change 1 to L)
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
Glad to hear you are enjoying the forum(s). I learn somthing new every day as well.
Thanks and Good Luck!
zemp
RE: Error opening ACCPACXAPILib.xapiSession in VB.NET
System.GC.Collect()
System.GC.WaitForPendingFinalizers()
i guest that you need to force the Garbage collector to complete the destroy of the views...
That works for me , hope this help