SqlConnection connection = new SqlConnection(connectionString);
connection.Open();
connection.ConnectionTimeout = 6000;我这样设置了ConnectionTimeout,可是系统说ConnectionTimeout是只读的,不让我设置,这是怎么回事?

解决方案 »

  1.   

    在连接字符串加Connect Timeout=6000,最好也设置SqlCommandTimeout
      

  2.   

    不好意思,再问一下,什么叫“在连接字符串加”?
    是不是比如我定义了: SqlCommand command = ....
    然后接着加上  Connect   Timeout = 6000;
    和         command.CommandTimeout = 6000;
      

  3.   

    在连接字符串里加就是打个比方:
    "Data Source=server;Initial Catalog=db;User ID=test;Password=test;Connect TimeOut=6000;"
      

  4.   

    万分感谢,明白了,再请教一下,那这句:
      <httpRuntime maxRequestLength="102400" executionTimeout="720"/> 
    和Connect   TimeOut有什么区别呢?
      

  5.   

    一个是数据库连接的,一个是web请求连接的timeout