Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid Signon Information (Login to SAGE 300 from VB.NET) 2

Status
Not open for further replies.

aan09

Programmer
Mar 21, 2018
29
ID
I get this error when I run my program, please help

error_m780rf.jpg


I already input the right user and password but still get the error.
And after I checked the program, It can run well in Windows 10 but get the error above if run in Windows Server.

and this is my script :

'Accpac Session (Must be created)
Dim session As ACCPAC.Advantage.Session
Dim mDBLinkCmpRW As ACCPAC.Advantage.DBLink

session = New ACCPAC.Advantage.Session()
session.Init("", "XX", "XX1000", "65A")
session.Open("ADMIN", "ADMIN", "TESTDT", DateTime.Today, 0)
mDBLinkCmpRW = session.OpenDBLink(ACCPAC.Advantage.DBLinkType.Company, ACCPAC.Advantage.DBLinkFlags.ReadWrite)

'Declare GL Entry View
Dim GLBATCH1batch As ACCPAC.Advantage.View
Dim GLBATCH1header As ACCPAC.Advantage.View
Dim GLBATCH1detail1 As ACCPAC.Advantage.View
Dim GLBATCH1detail2 As ACCPAC.Advantage.View
Dim GLPOST2 As ACCPAC.Advantage.View

'Open GL Entry View
GLBATCH1batch = mDBLinkCmpRW.OpenView("GL0008")
GLBATCH1header = mDBLinkCmpRW.OpenView("GL0006")
GLBATCH1detail1 = mDBLinkCmpRW.OpenView("GL0010")
GLBATCH1detail2 = mDBLinkCmpRW.OpenView("GL0402")
GLPOST2 = mDBLinkCmpRW.OpenView("GL0030")

'Compose GL Entry View
GLBATCH1batch.Compose({GLBATCH1header})
GLBATCH1header.Compose({GLBATCH1batch, GLBATCH1detail1})
GLBATCH1detail1.Compose({GLBATCH1header, GLBATCH1detail2})
GLBATCH1detail2.Compose({GLBATCH1detail1})


GLBATCH1batch.RecordCreate(ViewRecordCreate.Insert)
GLBATCH1batch.Fields.FieldByName("PROCESSCMD").SetValue("1", False) ' Lock Batch Switch
GLBATCH1header.Fields.FieldByName("BTCHENTRY").SetValue("00000", False) ' Entry Number

GLBATCH1header.RecordCreate(ViewRecordCreate.DelayKey)
GLBATCH1batch.Fields.FieldByName("BTCHDESC").SetValue("Merchant Settlement 20180620", False) ' Description
GLBATCH1header.Fields.FieldByName("DOCDATE").SetValue("2018, 6, 20", False) ' Document Date

GLBATCH1detail1.RecordCreate(ViewRecordCreate.NoInsert)
GLBATCH1detail1.Fields.FieldByName("TRANSNBR").SetValue("-000000003", False) ' Transaction Number
GLBATCH1detail1.Fields.FieldByName("ACCTID").SetValue("220101", False) ' Account Number
GLBATCH1detail1.Fields.FieldByName("TRANSDESC").SetValue("Merchant settlement - PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1detail1.Fields.FieldByName("TRANSREF").SetValue("PAYOUT_20180620_20180621031003", False) ' Reference
GLBATCH1detail1.Fields.FieldByName("SCURNAMT").SetValue("-7364878", False) ' Source Currency Amount
GLBATCH1detail1.Insert()

GLBATCH1detail1.RecordCreate(ViewRecordCreate.NoInsert)
GLBATCH1detail1.Fields.FieldByName("TRANSNBR").SetValue("-000000004", False) ' Transaction Number
GLBATCH1detail1.Fields.FieldByName("ACCTID").SetValue("220101", False) ' Account Number
GLBATCH1detail1.Fields.FieldByName("TRANSDESC").SetValue("Merchant settlement - PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1detail1.Fields.FieldByName("TRANSREF").SetValue("PAYOUT_20180620_20180621031003", False) ' Reference
GLBATCH1detail1.Fields.FieldByName("SCURNAMT").SetValue("0", False) ' Source Currency Amount
GLBATCH1detail1.Insert()

GLBATCH1detail1.RecordCreate(ViewRecordCreate.NoInsert)
GLBATCH1detail1.Fields.FieldByName("TRANSNBR").SetValue("-000000005", False) ' Transaction Number
GLBATCH1detail1.Fields.FieldByName("ACCTID").SetValue("401001", False) ' Account Number
GLBATCH1detail1.Fields.FieldByName("TRANSDESC").SetValue("Merchant settlement - PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1detail1.Fields.FieldByName("TRANSREF").SetValue("PAYOUT_20180620_20180621031003", False) ' Reference
GLBATCH1detail1.Fields.FieldByName("SCURNAMT").SetValue("47541", False) ' Source Currency Amount
GLBATCH1detail1.Insert()

GLBATCH1detail1.RecordCreate(ViewRecordCreate.NoInsert)
GLBATCH1detail1.Fields.FieldByName("TRANSNBR").SetValue("-000000006", False) ' Transaction Number
GLBATCH1detail1.Fields.FieldByName("ACCTID").SetValue("211000", False) ' Account Number
GLBATCH1detail1.Fields.FieldByName("TRANSDESC").SetValue("Merchant settlement - PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1detail1.Fields.FieldByName("TRANSREF").SetValue("PAYOUT_20180620_20180621031003", False) ' Reference
GLBATCH1detail1.Fields.FieldByName("SCURNAMT").SetValue("4754", False) ' Source Currency Amount
GLBATCH1detail1.Insert()

GLBATCH1detail1.RecordCreate(ViewRecordCreate.NoInsert)
GLBATCH1detail1.Fields.FieldByName("TRANSNBR").SetValue("-000000007", False) ' Transaction Number
GLBATCH1detail1.Fields.FieldByName("ACCTID").SetValue("151009", False) ' Account Number
GLBATCH1detail1.Fields.FieldByName("TRANSDESC").SetValue("Merchant settlement - PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1detail1.Fields.FieldByName("TRANSREF").SetValue("PAYOUT_20180620_20180621031003", False) ' Reference
GLBATCH1detail1.Fields.FieldByName("SCURNAMT").SetValue("-951", False) ' Source Currency Amount
GLBATCH1detail1.Insert()

GLBATCH1detail1.RecordCreate(ViewRecordCreate.NoInsert)
GLBATCH1detail1.Fields.FieldByName("TRANSNBR").SetValue("-000000008", False) ' Transaction Number
GLBATCH1detail1.Fields.FieldByName("ACCTID").SetValue("202001", False) ' Account Number
GLBATCH1detail1.Fields.FieldByName("TRANSDESC").SetValue("Merchant settlement - PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1detail1.Fields.FieldByName("TRANSREF").SetValue("PAYOUT_20180620_20180621031003", False) ' Reference
GLBATCH1detail1.Fields.FieldByName("SCURNAMT").SetValue("7313534", False) ' Source Currency Amount
GLBATCH1detail1.Insert()

GLBATCH1header.Fields.FieldByName("JRNLDESC").SetValue("PT INOVASI DAYA SOLUSI", False) ' Description
GLBATCH1header.Insert()
 
1. Use the COMAPI, not the Accpac Advantage library.
2. Make sure Sage is installed on the server

Sage 300 Whisperer
 
Do you have sample or tutorial how to use COMAPI?
I have already installed Sage on the server.
 
It's pretty much the same except for the AccpacCOMAPI in your project References.

...
Public Session As AccpacSession
Public a4wLink As AccpacDBLink
Public a4wLinkRead As AccpacDBLink
...
Session = New AccpacSession
Session.Init("", "XY", "XY0001", "65A")
Try
Session.Open(My.Settings.SageUser, My.Settings.SagePW, My.Settings.Company, Date.Today, 0, "")
Catch ex As Exception
Console.WriteLine(ex.Message)
End Try
a4wLink = Session.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE)
a4wLinkRead = Session.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READONLY)
...

Also note that Sage passwords should be in UPPERCASE

Sage 300 Whisperer
 
I had tried your method but I got error "Session is not opened" on the line "a4wLink...
 
Then you're doing something basic wrong. Can you login to the Sage desktop on that server with those credentials?

Sage 300 Whisperer
 
Yes, I can login to Sage desktop with those credentials. When I run my program I cannot open the session from server that use windows server 2016 but when I run it from client that use windows 10 it can run well without any session problem.
 
Then something isn't correctly installed. Make sure all Sage installs are at the same service pack level, and disable UAC on the server.

Sage 300 Whisperer
 
Thanks jay and DjangMan, I can run the program well after run the Visual Studio as Administrator [thumbsup2]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top