I’m refactoring some code that I posted yesterday for the HH Cycle Count Entry screen. I have all of the searches etc working using BO, but struggling with populating 2 values into the “tagView” EDV that exists on the form.
adapterCCTag.BOConnect();
bool morePages;
SearchOptions opts = new SearchOptions(SearchMode.AutoSearch);
opts.DataSetMode = DataSetMode.RowsDataSet;
string whereClause = "TagStatus = 0 AND TagReturned = 0 BY BinNum, PartNum";
opts.NamedSearch.WhereClauses.Add("CCTag", whereClause);
opts.PageSize = 1;
DataSet dsCCTagSearch = adapterCCTag.GetRows(opts, out morePages);
if (dsCCTagSearch.Tables["CCTag"].Rows.Count > 0)
{
EpiDataView edvTag = ((EpiDataView)(oTrans.EpiDataViews["tagView"]));
System.Data.DataRow edvTagRow = edvTag.CurrentDataRow;
if ((edvTagRow != null))
{
MessageBox.Show("WH contains: " + edvTagRow["WarehouseCode"]);
edvTagRow.BeginEdit();
edvTagRow["WarehouseCode"] = dsCCTagSearch.Tables["CCTag"].Rows[0]["WarehouseCode"];
edvTagRow["TagNum"] = dsCCTagSearch.Tables["CCTag"].Rows[0]["TagNum"];
edvTagRow.EndEdit();
}
}
I’m finding that there is no edvTagRow, hence not reaching that if statement. On the screen itself, when you provide Warehouse Code, then TagNum and leave the field it creates a Row (confirmed using row counts).
How best to create a row myself in code?