1 private static SqlCommand getSQlCommand(String SQl, SqlTransaction trans)
2 {
3 SqlCommand cmd = new SqlCommand(SQl);
4 if (con != null)
5 {
6 if (con.State != ConnectionState.Open)
7 {
8 OpenConnection();
9 }
10 }
11 else
12 {
13 OpenConnection();
14 }
15 cmd.Connection = con;
16 if (trans != null)
17 {
18 cmd.Transaction = trans;
19 }
20 return cmd;
21 }