我正在尝试查询数据库,以便在搜索“街道”时,显示所有带有“街道”的地址。
Address: <asp:TextBox ID="txtAddress" runat="server"></asp:TextBox>
<asp:SqlDataSource ID="sqlAddress" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionDataBase %>"
SelectCommand="SELECT Address, City, State, County, Type FROM Addresses WHERE (Address = @Address)"
FilterExpression="Address like '%{0}%'"
EnableCaching="True">
<SelectParameters>
</SelectParameters>
<FilterParameters>
<asp:ControlParameter ControlID="txtAddress" Name="Address" PropertyName="Text" Type="String" />
</FilterParameters>
</asp:SqlDataSource>
<asp:GridView ID="grdAddress" DataSourceID="sqlAddress"
AutoGenerateColumns="False" runat="server">
<Columns>
<asp:BoundField DataField="Address" HeaderText="Address"
SortExpression="Address" />
</Column>
</asp:GridView>