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

 

posted on 2006-08-14 20:18  xiaowy  阅读(270)  评论(0编辑  收藏  举报