2010-06-23 141 views

回答

1

對於MySQL,你可以在ConnectionString sepecify將CommandTimeout:

<connectionStrings> 
    <add name="Local" connectionString="Server=localhost; 
     Database=db;uid=admin;Password=pass;default command timeout=60" /> 
</connectionStrings> 

但SqlServer的,你不能這樣做,據我所知。對於SubSonic 2來說,沒有簡單的方法來實現它。 有在源硬編碼的多個命令超時(看看文件SqlDataProvider.cs)

Query.cs

private int commandTimeout = 60; 

QueryCommand.cs

/// <summary> 
/// Summary for the QueryCommand class 
/// </summary> 
public class QueryCommand 
{ 
    private string _providerName = String.Empty; 
    private int commandTimeout = 60; // change to whatever you like and recompile 

StoredProedure.cs:

private int commandTimeout = 60; 

我不知道我是否錯過了一些零件,但如果您更改了這些值並重新編譯SubSonic你應該沒問題。

如果你不想這樣做,你使用查詢工具,您可以在運行時設置超時時間

cmd.CommandTimeout = 600;