这是我的问题:我建立了一个小型 ASP.Net 站点来显示来自我们的一个内部数据库的一些数据。我已将查询设置为在单击按钮时运行,并考虑输入到 4 个不同文本框中的参数。如果我将查询限制在前 100 万行左右,这一切都很好。问题是我的表有超过 5500 万行。如果我取下限制器,我会经常遇到溢出和内存错误。我并不感到惊讶,但我想知道是否有办法解决这个问题。我想知道参数是否仅在运行查询后才应用。对不起,如果我不准确,我上周才开始做这些事情。这是我的代码:
<asp:Content ID="BodyContent" runat="server" ContentPlaceHolderID="MainContent">
<span class="style1">
<strong>Date </strong>(dd/mm/yyyy) </span>
<asp:TextBox ID="TextBox4" runat="server" Text="14/08/2009" style="margin-left: 4px"
Width="125px"></asp:TextBox>
TO
<asp:TextBox ID="TextBox5" runat="server" Width="125px" Text="30/12/2012" ></asp:TextBox>
<br />
<span class="style1"><strong>Trans # </strong></span>
<asp:TextBox ID="TextBox2" runat="server" style="margin-left: 94px"
Width="125px"></asp:TextBox>
<br />
<strong><span class="style1">Part </span></strong>
<asp:TextBox ID="TextBox3" runat="server" style="margin-left: 117px"
Width="125px"></asp:TextBox>
<br />
<br />
<asp:Button ID="Button1" runat="server" Text="Go" onclick="Button1_Click" />
<br />
<br />
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False" CellPadding="4"
ForeColor="#333333" GridLines="None" HorizontalAlign="Left"
onselectedindexchanged="GridView1_SelectedIndexChanged"
style="text-align: center" >
<AlternatingRowStyle BackColor="White" ForeColor="#284775" />
<Columns>
<asp:BoundField DataField="C6946_TRANS_TYPE" HeaderText="Type de Transaction/Transaction Type"
SortExpression="C6946_TRANS_TYPE" />
<asp:BoundField DataField="C6946_TRANS_DATE"
HtmlEncode="false" HeaderText="Date de Transaction/Transaction Date" ConvertEmptyStringToNull="false"
SortExpression="C6946_TRANS_DATE" FooterStyle-HorizontalAlign="Right" DataFormatString="{0:d}"
>
"
SelectCommand="SELECT C6946_TRANS_TYPE, C6946_TRANS_DATE, C6946_SO, C6946_LATE_FLAG, C6946_TRANS_NUM, ALIGNED_PART_NUMBER, C1001_ENG_PART_NUMBER, C6946_PART_KEY, PART_DESCRIPTION, C6946_RECORD FROM DWH.AIXW2S_T6946_TRANS_IMS"
FilterExpression= "C6946_TRANS_NUM LIKE '%{0}%' AND (C6946_PART_KEY LIKE '%{1}%' OR ALIGNED_PART_NUMBER LIKE '%{1}%' OR C1001_ENG_PART_NUMBER LIKE '%{1}%') AND C6946_TRANS_DATE >= #{2}# AND C6946_TRANS_DATE <= #{3}#">
<FilterParameters>
<asp:ControlParameter ControlID="TextBox2" Name="C6946_TRANS_NUM" PropertyName="text" Type="String" DefaultValue="" ConvertEmptyStringToNull="false"/>
<asp:ControlParameter ControlID="TextBox3" Name="C6946_PART_KEY" PropertyName="text" Type="string" DefaultValue="" ConvertEmptyStringToNull="false"/>
<asp:ControlParameter ControlID="TextBox4" Name="C6946_TRANS_DATE" PropertyName="text" Type="DateTime" DefaultValue="" ConvertEmptyStringToNull="false"/>
<asp:ControlParameter ControlID="TextBox5" Name="C6946_TRANS_DATE" PropertyName="text" Type="DateTime" DefaultValue="" ConvertEmptyStringToNull="false"/>
</FilterParameters>
</asp:SqlDataSource>
<br />
</asp:Content>