1
foreach(EventLog log in logList)
2
{
3
CreateEventLog(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
16
CreateEventLogList(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
33
CreateEventLogList(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

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47
