使用vs2005将一个dataview绊定数据源,删除出错,提示必须声明变量?
<form id= "form1 " action= " " method= "post " runat= "server ">
<asp:GridView ID= "GridView1 " runat= "server " AllowPaging= "True " AllowSorting= "True "
BackColor= "White " BorderColor= "#CC9966 " BorderStyle= "None " BorderWidth= "1px "
CellPadding= "4 " DataSourceID= "SqlDataSource1 " AutoGenerateColumns= "False " DataKeyNames= "id ">
<FooterStyle BackColor= "#FFFFCC " ForeColor= "#330099 " />
<Columns>
<asp:CommandField ShowDeleteButton= "True " />
<asp:BoundField DataField= "id " HeaderText= "id " InsertVisible= "False " ReadOnly= "True "
SortExpression= "id " />
<asp:BoundField DataField= "Province " HeaderText= "Province " SortExpression= "Province " />
<asp:BoundField DataField= "LearningCenter " HeaderText= "LearningCenter " SortExpression= "LearningCenter " />
<asp:BoundField DataField= "Xxiao " HeaderText= "Xxiao " SortExpression= "Xxiao " />
<asp:BoundField DataField= "Pci " HeaderText= "Pci " SortExpression= "Pci " />
<asp:BoundField DataField= "Cci " HeaderText= "Cci " SortExpression= "Cci " />
<asp:BoundField DataField= "ZHye " HeaderText= "ZHye " SortExpression= "ZHye " />
<asp:BoundField DataField= "Name " HeaderText= "Name " SortExpression= "Name " />
<asp:BoundField DataField= "Sex " HeaderText= "Sex " SortExpression= "Sex " />
<asp:BoundField DataField= "Certificate " HeaderText= "Certificate " SortExpression= "Certificate " />
<asp:BoundField DataField= "CertificateNO " HeaderText= "CertificateNO " SortExpression= "CertificateNO " />
<asp:BoundField DataField= "MobilePhone " HeaderText= "MobilePhone " SortExpression= "MobilePhone " />
<asp:BoundField DataField= "HomePhone " HeaderText= "HomePhone " SortExpression= "HomePhone " />
<asp:BoundField DataField= "PostCode " HeaderText= "PostCode " SortExpression= "PostCode " />
<asp:BoundField DataField= "PostAddress " HeaderText= "PostAddress " SortExpression= "PostAddress " />
<asp:BoundField DataField= "TimeAt " HeaderText= "TimeAt " SortExpression= "TimeAt " />
</Columns>
<RowStyle BackColor= "White " ForeColor= "#330099 " />
<SelectedRowStyle BackColor= "#FFCC66 " Font-Bold= "True " ForeColor= "#663399 " />
<PagerStyle BackColor= "#FFFFCC " ForeColor= "#330099 " HorizontalAlign= "Center " />
<HeaderStyle BackColor= "#990000 " Font-Bold= "True " ForeColor= "#FFFFCC " />
</asp:GridView>
<asp:SqlDataSource ID= "SqlDataSource1 " runat= "server " ConnectionString= " <%$ ConnectionStrings:bbsConnectionString %> "
DeleteCommand= "DELETE FROM open_baoming where id=@id " SelectCommand= "SELECT * FROM open_baoming ">
</asp:SqlDataSource>
</form>
[解决办法]
帮顶先