Beispiel #1
0
 /// <summary>
 /// 批量执行 SQL 语句,返回受影响的行数
 /// </summary>
 /// <param name="sql"></param>
 /// <returns></returns>
 public static int RunSQL(List <string> sqls)
 {
     if ("odbc".Equals(dbType))
     {
         return(DBAccessOfOdbc.RunSQL(sqls));
     }
     else if ("oledb".Equals(dbType))
     {
         return(DBAccessOfOleDb.RunSQL(sqls));
     }
     else if ("oracle9i".Equals(dbType))
     {
         return(DBAccessOfOracle9i.RunSQL(sqls));
     }
     else if ("sql".Equals(dbType))
     {
         return(DBAccessOfSql.RunSQL(sqls));
     }
     else if ("sqlite".Equals(dbType))
     {
         return(DBAccessOfSQLite.RunSQL(sqls));
     }
     else
     {
         return(0);
     }
 }
Beispiel #2
0
 /// <summary>
 /// 检查是不是存在
 /// </summary>
 /// <param name="sql">SQL语句</param>
 /// <returns>true,存在;false,不存在。</returns>
 public static bool IsExits(string sql)
 {
     if ("odbc".Equals(dbType))
     {
         return(DBAccessOfOdbc.IsExits(sql));
     }
     else if ("oledb".Equals(dbType))
     {
         return(DBAccessOfOleDb.IsExits(sql));
     }
     else if ("oracle9i".Equals(dbType))
     {
         return(DBAccessOfOracle9i.IsExits(sql));
     }
     else if ("sql".Equals(dbType))
     {
         return(DBAccessOfSql.IsExits(sql));
     }
     else if ("sqlite".Equals(dbType))
     {
         return(DBAccessOfSQLite.IsExits(sql));
     }
     else
     {
         return(false);
     }
 }
Beispiel #3
0
 /// <summary>
 /// 运行sql结果返回到DataTable
 /// </summary>
 /// <param name="sql">Sql语句</param>
 /// <returns></returns>
 public static DataTable RunSQLReturnTable(string sql)
 {
     if ("odbc".Equals(dbType))
     {
         return(DBAccessOfOdbc.RunSQLReturnTable(sql));
     }
     else if ("oledb".Equals(dbType))
     {
         return(DBAccessOfOleDb.RunSQLReturnTable(sql));
     }
     else if ("oracle9i".Equals(dbType))
     {
         return(DBAccessOfOracle9i.RunSQLReturnTable(sql));
     }
     else if ("sql".Equals(dbType))
     {
         return(DBAccessOfSql.RunSQLReturnTable(sql));
     }
     else if ("sqlite".Equals(dbType))
     {
         return(DBAccessOfSQLite.RunSQLReturnTable(sql));
     }
     else
     {
         return(null);
     }
 }