当我在文件后面调用代码时,我收到此错误。
过程或函数'GetALLSurveyor_ForTeam_Update'需要参数'@ID',这是未提供的。
我的代码是
sdsSurveyor.SelectParameters.Add("@ID", TeamID)
sdsSurveyor.SelectCommand = "GetALLSurveyor_ForTeam_Update"
sdsSurveyor.InsertCommandType = SqlDataSourceCommandType.StoredProcedure
chklistsurveyor.DataSourceID = "sdsSurveyor"
chklistsurveyor.DataBind()
并在aspx文件中
<asp:CheckBoxList ID="chklistsurveyor" CellSpacing="10" CellPadding="10" RepeatLayout="Table"
CssClass="mycheckbox" TextAlign="Right" DataTextField="NAME" DataValueField="ID"
RepeatDirection="Horizontal" RepeatColumns="2" runat="server">
</asp:CheckBoxList>
<asp:SqlDataSource ID="sdsSurveyor" ConnectionString="<%$ ConnectionStrings:ApplicationServices%>" runat="server">
</asp:SqlDataSource>
答案 0 :(得分:0)
您也需要将sdsSurveyor.SelectCommandType
设置为SqlDataSourceCommandType.StoredProcedure
! (不仅仅是代码中的.InsertCommandType
):
sdsSurveyor.SelectParameters.Add("@ID", TeamID)
sdsSurveyor.SelectCommand = "GetALLSurveyor_ForTeam_Update"
// make sure you have this line in there somewhere
sdsSurveyor.SelectCommandType = SqlDataSourceCommandType.StoredProcedure