<asp:SqlDataSource ID="HopefulDataSource" runat="server"
ConnectionString="<%$ ConnectionStrings:MyConnectionString %>"
SelectCommand= "SELECT id, regGroupID, amountReceived, other FROM table"
UpdateCommand="UPDATE table
SET [amountReceived] = @amountReceived
WHERE [regGroupID] = @regGroupID">
<SelectParameters>
<asp:ControlParameter ControlID="ddlCourses" Name="ddlSelectedCourse" PropertyName="SelectedValue" Type="String" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="regGroupID" Type="Int32" />
<asp:Parameter Name="amountReceived" Type="Decimal" />
other parameters
<asp:Parameter Name="id" Type="Int32" />
</UpdateParameters>
</asp:SqlDataSource>
上述工程當我改變 「WHERE [regGroupID] = @regGroupID」 要麼爲什麼我的SqlDataSource的UpdateCommand不工作?
WHERE [ID] = @id
或
WHERE [regGroupID] = 2
你是如何設置你的regGroupID參數的值? – 2013-02-26 14:27:22
通過GridView行編輯 – statue 2013-02-26 14:28:46