Hi All,
As I said from topic, I want to update data into BAQ Update but can’t. I need some advise.
My code as below:
private void oTrans_groupAdapter_BeforeAdapterMethod(object sender, BeforeAdapterMethodArgs args)
{
switch (args.MethodName)
{
case "Update":{
// ** Place Event Handling Code Here **
EpiDataView edvRcvDtl = (EpiDataView)oTrans.EpiDataViews["APInvHed"];
if (edvRcvDtl != null && edvRcvDtl.Row > -1)
{
DataRowView rcvRow = edvRcvDtl.dataView[edvRcvDtl.Row];
string param = rcvRow["GroupID"].ToString();
DynamicQueryAdapter dqadptr = new DynamicQueryAdapter(oTrans);
dqadptr.BOConnect();
string baqname = "BAQ_UpdateReport_c";
Ice.BO.QueryExecutionDataSet dsBAQ = dqadptr.GetQueryExecutionParametersByID(baqname);
dsBAQ.ExecutionParameter[0].ParameterID = "GroupID";
dsBAQ.ExecutionParameter[0].IsEmpty = false;
dsBAQ.ExecutionParameter[0].ParameterValue = param;
dsBAQ.AcceptChanges();
dqadptr.ExecuteByID(baqname, dsBAQ);
DataTable results = dqadptr.QueryResults.Tables["Results"];
if (results != null && results.Rows.Count > 0)
{
// some code to arrive at your next lot number - round trip to int with Int32.TryParse and back to string?
rcvRow.BeginEdit();
rcvRow["Description"] = "Test Update";
rcvRow.EndEdit();
dqadptr.Update(baqname, results.DataSet);
results.AcceptChanges();
}
results = null;
dqadptr.Dispose();
}
break;
}
}
}