zoukankan      html  css  js  c++  java
  • Time Out 访问数据库超时处理 .NET

     1 using System.Reflection;
     2 
     3 using System.Data.SqlClient;
     4 
     5  
     6 
     7      
     8 
     9             TransactionSelectTableAdapter adapter = new TransactionSelectTableAdapter();
    10 
    11             Type adapterType = adapter.GetType();
    12 
    13             PropertyInfo commandProperty = adapterType.GetProperty("CommandCollection", System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance);
    14 
    15             SqlCommand[] commandList = (SqlCommand[])commandProperty.GetValue(adapter, null);
    16 
    17             commandList[0].CommandTimeout = 3000;

    也有同事之间改某个文件的属性,相对感觉欠优雅。

    个人喜欢另一个同事教我的方法,如上。

    对了,对于那些同事们教我的事,

    感谢我的同事们,God bless you!!!

    仅供参考。

  • 相关阅读:
    特殊集合
    推箱子
    集合
    数组

    循环语句 练习题
    穷举与迭代
    循环语句
    练习题
    switch case
  • 原文地址:https://www.cnblogs.com/coderinprague/p/3785463.html
Copyright © 2011-2022 走看看