我正在尝试将SqlDataSource的超时延长超过30秒(似乎是默认值).我正在尝试运行一个必须运行100,000个记录的存储过程.在繁忙时段,它会超时.我在2003服务器上使用ASP.NET 4.0和IIS 6.0.
错误消息: 超时已过期.操作完成之前经过的超时时间或服务器没有响应.
我试图无法延长超时:
< asp:SqlDataSource ID="dsTest" EnableCaching="true" CacheDuration="604800" runat="server" ConnectionString="<%$ ConnectionStrings:SuperNARIC %>" SelectCommand="selectStatus" SelectCommandType="StoredProcedure" onselecting="dsTest_Selecting" >
<SelectParameters>
< asp:ControlParameter ControlID="ddlCar" Name="CountryID" PropertyName="SelectedValue" Type="Int32" />
< /SelectParameters>
< /asp:SqlDataSource>
protected void dsTest_Selecting(object sender, SqlDataSourceSelectingEventArgs e)
{
e.Command.CommandTimeout = 300;
}
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
谢谢
我正在尝试从众多下拉列表中获取值,并根据所选的选项构建where语句.如果他们没有被选中,那么他们应该从select语句中排除.
我就是这样做的,但我认为用linq不能用这种方式完成.
IEnumerable<IGrouping<string, Forest>> treeQuery =
from trees in Forest
if (ddlType1.SelectedValue!=null)
{
string strWhere += trees.Type1 == ddlType1.SelectedValue
}
else if (ddlType2.SelectedValue!=null)
{
string strWhere += trees.Type2 == ddlType2.SelectedValue
}
where strWhere
orderby trees.Nuts
group trees by trees.TrunkColour;
Run Code Online (Sandbox Code Playgroud)
任何帮助将不胜感激.
这是我在...中添加示例之前的代码
IEnumerable<IGrouping<string, Forest>> treeQuery =
from trees in Forest
where trees.Type1 == "oak"
orderby trees.Nuts
group trees by trees.TrunkColour;
Run Code Online (Sandbox Code Playgroud)