Example #1
0
        private int ExecuteSqlTran2(DBConnect connect, List <SqlObject> sqlobj)
        {
            switch (connect.Type)
            {
            case "sqlserver":
            {
                var dbHelperMySql = new DbHelperSqlServer(connect.ConnectString);
                return(dbHelperMySql.ExecuteSqlTran2(sqlobj.Select(
                                                         m => new SqlItem <SqlParameter>(m.Sql, m.Parameters.Select(
                                                                                             p => new SqlParameter(p.Name, SqlDbType.NVarChar)
                    {
                        Value = p.Value
                    }
                                                                                             ).ToArray())
                                                         ).ToList()));
            }
            break;

            default:
            {
                var dbHelperMySql = new DbHelperMySql(connect.ConnectString);
                return(dbHelperMySql.ExecuteSqlTran2(sqlobj.Select(
                                                         m => new SqlItem(m.Sql, m.Parameters.Select(
                                                                              p => new MySqlParameter(p.Name, MySqlDbType.VarChar)
                    {
                        Value = p.Value
                    }
                                                                              ).ToArray())
                                                         ).ToList()));
            }
            break;
            }
            return(0);
        }
Example #2
0
 public static int ExecuteSqlTran2(List <SqlItem> al)
 {
     return(dbHelperMySql.ExecuteSqlTran2(al));
 }