服务器控件的name属性务须要和存储过程的参数名一致吗
服务器控件<asp:ControlParameter>的name属性必须要和存储过程的参数名一致吗?
代码如下:
我将<asp:ControlParameter ControlID="AspNetPager1" DefaultValue="1" Name="startIndex"
PropertyName="StartRecordIndex" Type="Int32" />
中的"startIndex" 改为="startIndex1",运行程序就会产生错误:
Procedure or function 'P_GetPagedOrders2005' expects parameter '@startIndex', which was not supplied.
请问:
服务器控件<asp:ControlParameter>的name属性必须要和存储过程的参数名一致吗?
------解决思路----------------------
不光 SqlDataSource ,其他ObjectDataSource控件都必须保持名称一致。不然后台程序怎么知道字段如何匹配?
代码如下:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:SqlConnection %>"
SelectCommand="P_GetPagedOrders2005" SelectCommandType="StoredProcedure">
<SelectParameters>
<asp:ControlParameter ControlID="AspNetPager1" DefaultValue="1" Name="startIndex"
PropertyName="StartRecordIndex" Type="Int32" />
<asp:ControlParameter ControlID="AspNetPager1" DefaultValue="10" Name="endIndex"
PropertyName="EndRecordIndex" Type="Int32" />
</SelectParameters>
我将<asp:ControlParameter ControlID="AspNetPager1" DefaultValue="1" Name="startIndex"
PropertyName="StartRecordIndex" Type="Int32" />
中的"startIndex" 改为="startIndex1",运行程序就会产生错误:
Procedure or function 'P_GetPagedOrders2005' expects parameter '@startIndex', which was not supplied.
请问:
服务器控件<asp:ControlParameter>的name属性必须要和存储过程的参数名一致吗?
------解决思路----------------------
不光 SqlDataSource ,其他ObjectDataSource控件都必须保持名称一致。不然后台程序怎么知道字段如何匹配?