I have had this issue forever and I don't recall there is a fix to it. When a custom app uses session manager to log on to a session, it works perfect when there is only one session opened. However, when there is more than 1 sessions opened (Comp A and Comp B), the session manager from the custom app is confused, and prompts a screen to select which session to log on. I am just curious if there is fix, other than the SDK approach?
Code:
private void log_On_Existing_Accpac_Session()
{
try
{
vSessionMgr.AppID = AppID;
vSessionMgr.AppVersion = AppVersion;
vSessionMgr.ProgramName = ProgramName;
vSessionMgr.ServerName = ServerName;
vSessionMgr.CreateSession("", 0, out myAccpacSession); //this is graping the session from session manager, prompts to select from a list if more than 1 company is opened...
myAccpacSession.GetSignonInfo(out sAccpacUser, out sAccpacCompany, out sCompany2);
oDBLink = myAccpacSession.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
this.Text = "Custom Import [" + sAccpacCompany + "] - " + sCompany2;
toolStripStatusLabel1.Text = "User ID: " + sAccpacUser;
toolStripStatusLabel2.Text = "Company ID: " + sAccpacCompany;
toolStripStatusLabel3.Text = sCompany2;
toolStripStatusLabel4.Text = "Version: " + Application.ProductVersion + " for Sage 300 v " + myAccpacSession.AppVersion;
//lblSelectedShipments.Text = "No Shipment Selected. Shipment Total: $0.00";
}
catch (Exception ex)
{
MessageBox.Show("Fatal Error: " + ex.Message + "\nInternal Error Message: " + ex.InnerException, "Fatal Eror: Can't Logon to Accpac");
this.Close();
this.Dispose();
}
}
Code:
private void log_On_Existing_Accpac_Session()
{
try
{
vSessionMgr.AppID = AppID;
vSessionMgr.AppVersion = AppVersion;
vSessionMgr.ProgramName = ProgramName;
vSessionMgr.ServerName = ServerName;
vSessionMgr.CreateSession("", 0, out myAccpacSession); //this is graping the session from session manager, prompts to select from a list if more than 1 company is opened...
myAccpacSession.GetSignonInfo(out sAccpacUser, out sAccpacCompany, out sCompany2);
oDBLink = myAccpacSession.OpenDBLink(tagDBLinkTypeEnum.DBLINK_COMPANY, tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
this.Text = "Custom Import [" + sAccpacCompany + "] - " + sCompany2;
toolStripStatusLabel1.Text = "User ID: " + sAccpacUser;
toolStripStatusLabel2.Text = "Company ID: " + sAccpacCompany;
toolStripStatusLabel3.Text = sCompany2;
toolStripStatusLabel4.Text = "Version: " + Application.ProductVersion + " for Sage 300 v " + myAccpacSession.AppVersion;
//lblSelectedShipments.Text = "No Shipment Selected. Shipment Total: $0.00";
}
catch (Exception ex)
{
MessageBox.Show("Fatal Error: " + ex.Message + "\nInternal Error Message: " + ex.InnerException, "Fatal Eror: Can't Logon to Accpac");
this.Close();
this.Dispose();
}
}