GridView的UpdateCommand功能实现不了,报错01036:错误的变量名/编号
GridView的UpdateCommand功能实现不了,报错01036:错误的变量名/编号我的代码如下:
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
CellPadding="2" DataSourceID="SqlDataSource1" AllowPaging="True" Width="784px"
style="text-decoration:none" BackColor="LightSteelBlue" BorderColor="Ivory"
BorderStyle="Solid" BorderWidth="2px" CellSpacing="1" ForeColor="Black" Font-Size="X-Small"
AllowSorting="True" datakeynames="userID">
<FooterStyle BackColor="#CCCCCC" />
<RowStyle BackColor="White" />
<SelectedRowStyle BackColor="#000099" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="Snow" ForeColor="Black" HorizontalAlign="Left" />
<HeaderStyle BackColor="CornflowerBlue" Font-Bold="True" ForeColor="White" />
<EditRowStyle BackColor="InactiveCaptionText" />
<Columns>
<asp:BoundField DataField="userid" HeaderText="用户ID" SortExpression="USERID" />
<asp:BoundField DataField="username" HeaderText="用户名" SortExpression="USERNAME" />
<asp:BoundField DataField="userrname" HeaderText="角色" SortExpression="USERRNAME" />
<asp:BoundField DataField="dept" HeaderText="单位" SortExpression="DEPT" />
<asp:BoundField DataField="state" HeaderText="状态" SortExpression="STATE" />
<asp:CommandField ShowEditButton="True" />
<asp:CommandField ShowDeleteButton="True" />
</Columns>
</asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
SelectCommand="SELECT userid,username,USERRNAME,DEPT,STATE FROM T_USER"
UpdateCommand="Update T_user set username=@username,userrname=@userrname,dept=@dept,state=@state WHERE userID = @userID"
DeleteCommand="delete from t_user where userid=@userid">
</asp:SqlDataSource>