当名称包含连字符时,它无法获取正确的行。它实际上并没有获取任何东西
XAml:
<asp:EntityDataSource ID="EntityDataSource1" runat="server" ConnectionString="name=Entities"
DefaultContainerName="Entities" EnableFlattening="False" EntitySetName="CustomerClassifications">
</asp:EntityDataSource>
<div class="searchWrapper">
Search
<asp:Panel DefaultButton="btnSearch" runat="server" ID="pnlSearch">
<asp:TextBox ID="tbxSearch" runat="server" CssClass="tbxSearch">
</asp:TextBox>
<asp:Button ID="btnSearch" runat="server" CssClass="btnSearch" Text="Search" />
</asp:Panel>
</div>
代码背后:
this.EntityDataSource1.WhereParameters.Clear();
if (string.IsNullOrEmpty(tbxSearch.Text))
{
this.EntityDataSource1.Where = "1 = 1";
}
else
{
this.EntityDataSource1.Where = "it.Name = @Name ";
}