与ado.net同步的问题

时间:2011-01-09 13:35:55

标签: c# ado.net .net-2.0

我有一个方法可以通过storedprocedure添加投资状态(在这个方法中我检查实际状态是什么并将其插入表中)

public void AddStatusInvestment(InvestmentData.InvestmentRow Investment, InvestmentData ds, DictionaryData dict)
            {
            SomeMethodWHichUsesStoredProcedureWithActualStatus();
                     var statInw = PhaseStatusHelper.GetStatusesInvestment(Investment, ds);
            }

当我查看号码时,我看不到任何变化:

var statInw = PhaseStatusHelper.GetStatusesInvestment(Investment, ds);

 public static List<InvestmentData.StatusesInvestmentRow> GetStatusesInvestment(InvestmentData.InvestmentRow Investment, InvestmentData ds)
        {
            List<InvestmentData.StatusesInvestmentRow> Statuses = 
             new List<InvestmentData.StatusesInvestmentRow>();


        Statuses.AddRange(Investment.GetStatusesInvestmentRows());

        return Statuses;
    }

以下是设计师的代码:

        [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
        [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Data.Design.TypedDataSetGenerator", "2.0.0.0")]
        public StatusesInvestmentRow[] GetStatusesInvestmentRows() {
            if ((this.Table.ChildRelations["FK_Investment_StatusesInvestment"] == null)) {
                return new StatusesInvestmentRow[0];
            }
            else {
                return ((StatusesInvestmentRow[])(base.GetChildRows(this.Table.ChildRelations["FK_Investment_StatusesInvestment"])));
            }
        }

状态投资表:

InvestmentId int
EnumStatusesInvestment int
StatusesInvestmentId int PK

如何才能获得正确的状态数

当我再次启动我的申请时,投资状态的数量是正确的

1 个答案:

答案 0 :(得分:3)

调用存储过程后,您可能没有刷新数据集 数据集包含其数据的本地副本,不会自动更新。