zoukankan      html  css  js  c++  java
  • 改善应用程序的性能

     1foreach(EventLog log in logList)
     2{
     3CreateEventLog(log);
     4}

     5
     6 CreateEventLog(EventLog eventLog)
     7  {
     8            SqlConnection conn = new SqlConnection(ConnectionString);
     9            SqlHelper.MakeOutParam(cmd, "@ID", SqlDbType.Int, 4);
    10            ……
    11}

    12                                            |
    13                                            |    
    14                                            |
    15
    16CreateEventLogList(List<EventLog> eventLogList)
    17{
    18            SqlConnection conn = new SqlConnection(ConnectionString);
    19            SqlCommand cmd = SqlHelper.PrepareCommand("usp_EventLog_Create", conn, CommandType.StoredProcedure);
    20               ……
    21                conn.Open();
    22                    foreach (EventLog log in eventLogList)
    23                    {
    24                   cmd.Parameters.Clear();
    25                 SqlHelper.MakeInParam(cmd, "@Category", SqlDbType.NVarChar, 20, log.Category);
    26                    ……
    27                     }

    28}
            
    29                                            |
    30                                            |    
    31                                            |
    32
    33CreateEventLogList(List<EventLog> eventLogList)
    34{
    35            SqlConnection conn = new SqlConnection(ConnectionString);
    36            SqlCommand cmd = SqlHelper.PrepareCommand("usp_EventLog_Create", conn, CommandType.StoredProcedure);
    37            SqlHelper.MakeInParam(cmd, "@Category", SqlDbType.NVarChar, 20, DBNull.Value);
    38            ……
    39             conn.Open();
    40                    foreach (EventLog eventLog in eventLogList)
    41                    {
    42                        cmd.Parameters["@Category"].Value = eventLog.Category;
    43                    ……
    44                     }

    45}
            
    46                                       
    47
  • 相关阅读:
    LeftoverDataException,依赖包,apache license 2.0
    GPL,BSD,Apache,MIT开源许可协议
    一次重构经历
    转载:reactor模式学习
    版本控制学习
    系统开发,出错处理,日志
    最近学习linux命令的一个总结
    sudo,linux 新建账号,并开通ssh登录
    运行R 报错R cannot R_TempDir, 继而发现/dev/mapper/VG00-LV01 磁盘空间已满
    用InputStream读出来转换成String类型
  • 原文地址:https://www.cnblogs.com/xiaowy/p/476766.html
Copyright © 2011-2022 走看看