Hello all!
I have an experimental piece of code, and it does not work
the code is:
every time I run it, it crashes on this line:
the error says that "identifier objbatch is out of scope"
Could anyone please provide a reason for that happening?
Thanks in advance,
Anton.
I have an experimental piece of code, and it does not work
the code is:
Code:
private void button1_Click(object sender, System.EventArgs e)
{
try
{
string g_czAccPacDBName = "SAMINC";
string g_czAccPacUID = "DAVE";
string g_czAccPacPWD = "SSI2003";
AccpacCOMAPI.AccpacSession Session;
Session = new AccpacCOMAPI.AccpacSession();
// open the AP session
//session.Init("", "AS", "AS1000", "52A");
//
Session.Init("", "AS", "AS1000", "52A");
Session.Open(g_czAccPacUID, g_czAccPacPWD, g_czAccPacDBName, DateTime.Now, 0, "");
AccpacCOMAPI.AccpacDBLink mDBLinkCmpRW;
mDBLinkCmpRW = Session.OpenDBLink (AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_COMPANY,AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
AccpacCOMAPI.AccpacDBLink mDBLinkSysRW;
mDBLinkSysRW = Session.OpenDBLink (AccpacCOMAPI.tagDBLinkTypeEnum.DBLINK_SYSTEM,AccpacCOMAPI.tagDBLinkFlagsEnum.DBLINK_FLG_READWRITE);
//GL0008
//AccpacCOMAPI.AccpacView GLBATCH1batch;
//AccpacCOMAPI.AccpacViewFields GLBATCH1batchFields;
//mDBLinkCmpRW.OpenView ("GL0008", out GLBATCH1batch) ;
//GLBATCH1batchFields = GLBATCH1batch.Fields ;
AccpacCOMAPI.AccpacView GLBATCH1batch;
AccpacCOMAPI.AccpacView[] GLBATCH1batchComp = new AccpacCOMAPI.AccpacView[1];
AccpacCOMAPI.AccpacViewFields GLBATCH1batchFields;
mDBLinkCmpRW.OpenView ("GL0008", out GLBATCH1batch) ;
GLBATCH1batchFields = GLBATCH1batch.Fields ;
GLBATCH1batchComp[0] = GLBATCH1batch;
object objBatch = (object)GLBATCH1batchComp;
GLBATCH1batch.Compose(ref objBatch);
//GL0006
AccpacCOMAPI.AccpacView GLBATCH1header;
AccpacCOMAPI.AccpacViewFields GLBATCH1headerFields;
mDBLinkCmpRW.OpenView ("GL0006", out GLBATCH1header) ;
GLBATCH1headerFields = GLBATCH1header.Fields ;
//GL0010
AccpacCOMAPI.AccpacView GLBATCH1detail;
AccpacCOMAPI.AccpacViewFields GLBATCH1detailFields;
mDBLinkCmpRW.OpenView ("GL0010", out GLBATCH1detail) ;
GLBATCH1detailFields = GLBATCH1detail.Fields ;
Session.Close();
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
}
every time I run it, it crashes on this line:
Code:
GLBATCH1batch.Compose(ref objBatch);
Could anyone please provide a reason for that happening?
Thanks in advance,
Anton.