在所选数据源上找不到名为“ActualService”的字段或属性

时间:2012-12-02 11:29:30

标签: c# asp.net gridview

当我向gridview添加一些列时,我遇到了上述错误。但ActualService与我在数据库中的列相同。请帮我解决这个错误。

我的代码:

<Columns>
     <asp:TemplateField HeaderText="PMRMName" SortExpression="PMRMName">
         <ItemTemplate>
            <asp:HyperLink runat="server" ID="HyperLink1" NavigateUrl='<%# "db_PmuKpi_CF_AllPMs.aspx?PMRMID="+ Eval("PMRMID") + "&PMRMName =" + Eval("PMRMName")%>' Text='<%# Eval("PMRMName","{0}")%>' Target="_blank"></asp:HyperLink>
            <asp:Label ID="lblRM" runat="server"></asp:Label>
         </ItemTemplate>
      </asp:TemplateField>

      <asp:BoundField DataField="BudgetRevenue" HeaderText="BudgetRevenue" SortExpression="BudgetRevenue" />
      <asp:BoundField DataField="BudgetCOGS" HeaderText="BudgetCOGS" SortExpression="BudgetCOGS" />
      <asp:BoundField DataField="BudgetService" HeaderText="BudgetService" SortExpression="BudgetService" />
      <asp:BoundField DataField="BudgetCashFlow" HeaderText="BudgetCashFlow" SortExpression="BudgetCashFlow" />
      <asp:BoundField DataField="ActualRevenue" HeaderText="ActualRevenue" SortExpression="ActualRevenue" />
      <asp:BoundField DataField="ActualCOGS" HeaderText="ActualCOGS" SortExpression="ActualCOGS" />
      <asp:BoundField DataField="ActualService " HeaderText="ActualService " SortExpression="ActualService " />
      <asp:BoundField DataField="ActualCashFlow " HeaderText="ActualCashFlow " SortExpression="ActualCashFlow " />
</Columns>

我使用以下SQL:

select PMRMID,PMRMName,BudgetRevenue,BudgetCOGS,BudgetService,BudgetCashFlow, ActualRevenue, ActualCOGS, ActualService,ActualCashFlow from [fn_pmukpi_CurrentMonthCF_AllRMs] ---------my function –

1 个答案:

答案 0 :(得分:2)

您在BoundField(DataField)的列名中的“ActualService”和“ActualCashFlow”之后有一个空格。