0

我有以下代码,它将 DataSet 和 currenYear 作为参数。该代码应该查看 GrowthTarget DataTable,选择符合 Select 属性中条件的行,然后将其分配给 foundRows 数组。

下一部分只是简单地获取返回行中第二列的值并将其分配给 YearGrowthTarget。问题是当我运行它调试模式并在执行此分配的行上放置一个断点时,“步入”只是完全退出该方法并弄乱了应该在主窗体上显示的数据。我认为至少应该执行返回 YearGrowthTarget 但不,系统感觉就像超人并继续加载主窗体。

顺便说一句,代码应该在主窗体显示其数据之前运行。谁能告诉我做错了什么?

private static int NewYearFreshInstallationGrowthTarget(DataSet ds, int currentYear)
    {
        int YearGrowthTarget = 0;

        DataRow[] foundRows = ds.Tables["GrowthTarget"].Select(
                "GrowthTargetYear = " + currentYear);
        if (foundRows.Length == 0)
        {
            // There are no entries for current year, return 0.
            //TODO: Update statusLabel within original method that called
            //this methos: ComputeNetGrowth method.
        }
        else if (foundRows.Length == 1)
        {
            // There is an entry for current year so return target.
            YearGrowthTarget = (int)(foundRows[0].ItemArray[1]);
        }

        return YearGrowthTarget;
    }
4

0 回答 0