×
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!
  • Students Click Here

*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

Jobs

Connect Accpac in Asp.net web service application

Connect Accpac in Asp.net web service application

Connect Accpac in Asp.net web service application

(OP)
Dear All,

Can I use code below to connect Accpac in asp.net web service (it is fine in windows form application)?

Dim Session As New AccpacSession
Dim mDBLinkCmpRw As AccpacDBLink
Dim mSessMgr As AccpacSessionMgr
Dim mlSessionID As Long
'Open Session
mlSessionID = 0
mSessMgr = Nothing
Session = Nothing
If mSessMgr Is Nothing Then
mSessMgr = CreateObject("Accpac.SessionMgr")
With mSessMgr
'Set the session manager's properties.
.AppID = "XY"
.AppVersion = "61A"
.ProgramName = "XY0001"
End With ' mSessMgr
End If
'Only create the session if it doesn't already exist
If Session Is Nothing Then
mSessMgr.CreateSession("", mlSessionID, Session)
mDBLinkCmpRw = Session.OpenDBLink(DBLINK_COMPANY, DBLINK_FLG_READWRITE)
End If

Error:




System.UnauthorizedAccessException: Access is denied. (Exception from HRESULT: 0x80070005 (E_ACCESSDENIED)) at AccpacSessionManager.IAccpacSessionMgr.CreateSession(String ObjectHandle, Int32& SignonID, AccpacSession& Session)

RE: Connect Accpac in Asp.net web service application

Make sure the Sage client is installed and running on the IIS server.

Sage 300 Whisperer

RE: Connect Accpac in Asp.net web service application

(OP)
Hi Jay,

They are on the same server.

RE: Connect Accpac in Asp.net web service application

You don't need a session manager unless you plan to run UIs or macros. Otherwise, you can just create a session object. Plus, in your code example, you didn't open a session properly. You indicated that it worked on a workstation but I don't see where you specify the company you want to connect to, the session date, user or password. That makes me think that the signon screen was probably appearing.

CODE --> pseudo_code

set MySession = New AccpacCOMAPI.AccpacSession
MySession.Init(some parameters)
MySession.Open(this is where you supply company, user, pw, date)
set MyDBLink = MySession.OpenDBLink(some parameters) 

Now you'll be able to open views, process transactions, generate reports, etc. No signon manager required.

RE: Connect Accpac in Asp.net web service application

(OP)
Hi DjangMan ,
Thanks for you good support.

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!

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