×
INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Error opening ACCPACXAPILib.xapiSession in VB.NET
2

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()

 

RE: Error opening ACCPACXAPILib.xapiSession in VB.NET

Here is the syntax that I would use to create and Open a session object.

  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

(OP)
I have tried that and it unfortunately doesn't work in .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

From the information I have been able to find the xAPI is not yet compatible with VB.Net. We still need to use VB6. This information is suspect and based on some threads from the ACCPAC partner discission forums (ACCPAC website) using ACCPAC 5.0. I have not tested it myself or have I tried to use the ACCPAC xAPI with VB.Net. The key would be the a4wcomm.dll that houses the xAPI. If it hasn't changed then the information may be true. If I am incorrect I hope someone will set the record straight. I am looking into it further.

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

Can't quite get it to work in VB .NET web project but
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

(OP)
Thanks for the replies.  They have helped alot.

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

Well here is my question and the response form the other forum. From a very reputable poster.

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

VB .NET is COM compatible which means you can still use it without the ACCPAC native .NET library, although VBA and VB6 would still be my tools of choice.
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

VB .NET is COM compatible which means you can still use it without the ACCPAC native .NET library, although VBA and VB6 would still be my tools of choice.
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

rvspy, as mentioned in my second post ("...threads from the ACCPAC partner discission forums...") the other forum was the ACCPAC partner discussion forum. No, it was not JC.

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

I had a simmilar problem that i solve using two extra line just before de session.close()

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

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members! Already a Member? Login

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close