<asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True" DataSourceID="SqlDataSource2"
DataTextField="state" DataValueField="state">
asp:DropDownList><asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString=""
SelectCommand="SELECT DISTINCT [state] FROM [authors]">asp:SqlDataSource>
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True"
AutoGenerateColumns="False" BackColor="White" BorderColor="#CCCCCC" BorderStyle="None"
BorderWidth="1px" CellPadding="3" DataKeyNames="au_id" DataSourceID="SqlDataSource1"
OnRowDataBound="GridView1_RowDataBound">
<FooterStyle BackColor="White" ForeColor="#000066" />
<Columns>
<asp:CommandField HeaderText="操作" ShowEditButton="True" />
<asp:BoundField DataField="au_id" HeaderText="ID" ReadOnly="True" SortExpression="au_id" />
<asp:BoundField DataField="au_lname" HeaderText="名字" SortExpression="au_lname">
<ControlStyle Width="60px" />
asp:BoundField>
<asp:BoundField DataField="city" HeaderText="城市" SortExpression="city">
<ControlStyle Width="60px" />
asp:BoundField>
<asp:BoundField DataField="state" HeaderText="不知道" SortExpression="state">
<ControlStyle Width="60px" />
asp:BoundField>
<asp:BoundField DataField="zip" DataFormatString="{0:c}" HeaderText="邮编" SortExpression="zip">
<ControlStyle BackColor="#FFFFC0" BorderColor="#C0FFFF" BorderStyle="Solid" BorderWidth="1px"
Font-Bold="True" Width="60px" />
<ItemStyle BackColor="#FF8080" BorderStyle="Solid" Font-Bold="True" />
asp:BoundField>
Columns>
<RowStyle ForeColor="#000066" />
<SelectedRowStyle BackColor="#669999" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="White" ForeColor="#000066" HorizontalAlign="Left" />
<HeaderStyle BackColor="#006699" Font-Bold="True" ForeColor="White" />
asp:GridView>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString=""
DeleteCommand="DELETE FROM [authors] WHERE [au_id] = @au_id" InsertCommand="INSERT INTO [authors] ([au_id], [au_lname], [city], [state], [zip]) VALUES (@au_id, @au_lname, @city, @state, @zip)"
SelectCommand="SELECT [au_id], [au_lname], [city], [state], [zip] FROM [authors] WHERE ([state] = @state)"
UpdateCommand="UPDATE [authors] SET [au_lname] = @au_lname, [city] = @city, [state] = @state, [zip] = @zip WHERE [au_id] = @au_id">
<DeleteParameters>
<asp:Parameter Name="au_id" Type="String" />
DeleteParameters>
<UpdateParameters>
<asp:Parameter Name="au_lname" Type="String" />
<asp:Parameter Name="city" Type="String" />
<asp:Parameter Name="state" Type="String" />
<asp:Parameter Name="zip" Type="String" />
<asp:Parameter Name="au_id" Type="String" />
UpdateParameters>
<InsertParameters>
<asp:Parameter Name="au_id" Type="String" />
<asp:Parameter Name="au_lname" Type="String" />
<asp:Parameter Name="city" Type="String" />
<asp:Parameter Name="state" Type="String" />
<asp:Parameter Name="zip" Type="String" />
InsertParameters>
<SelectParameters>
<asp:ControlParameter ControlID="DropDownList1" Name="state" PropertyName="SelectedValue"
Type="String" />
SelectParameters>
asp:SqlDataSource>
浙公网安备 33010602011771号