Esempio n. 1
0
        /// <summary>
        /// 判断在Oracle数据库中是否存在表
        /// </summary>
        /// <param name="tbname">表名</param>
        /// <param name="dbname">所在库的DCDS连接名称</param>
        /// <returns></returns>
        private static bool IsOracleTableExist(string tbName, string dbName)
        {
            StringBuilder tableNameisExistSql = new StringBuilder();

            tableNameisExistSql.Append("SELECT COUNT(*) FROM USER_OBJECTS");
            tableNameisExistSql.Append("WHERE OBJECT_NAME = UPPER ('" + tbName + "'");
            DataTable dt = UserDataAccess.ExecuteDataSet(tableNameisExistSql.ToString());

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 2
0
        /// <summary>
        /// 判断在DB2数据库中是否存在表
        /// </summary>
        /// <param name="tbname">表名</param>
        /// <param name="dbname">所在库的DCDS连接名称</param>
        /// <returns></returns>
        private static bool IsDb2TableExist(string tbName, string dbName)
        {
            StringBuilder tableNameisExistSql = new StringBuilder();

            //SELECT * FROM SYSIBM.SYSTABLES WHERE TID <> 0 AND Name = 'T_IQV_COMMON_DATA'
            tableNameisExistSql.Append(" SELECT * FROM SYSIBM.TABLES ");
            tableNameisExistSql.Append(" WHERE TABLE_NAME = '" + tbName.ToUpper() + "'");
            DataTable dt = UserDataAccess.ExecuteDataSet(tableNameisExistSql.ToString());

            if (dt.Rows.Count > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Esempio n. 3
0
 /// <summary>
 /// 判断在SqlServer数据库中是否存在表
 /// </summary>
 /// <param name="tbname">表名</param>
 /// <param name="dbname">所在库的DCDS连接名称</param>
 /// <returns></returns>
 private static bool IsSqlServerTableExist(string tbname, string dbname)
 {
     try
     {
         StringBuilder tableNameisExistSql = new StringBuilder();
         tableNameisExistSql.Append("SELECT name FROM sys.objects ");
         tableNameisExistSql.Append("WHERE object_id = OBJECT_ID(N'[dbo].[" + tbname.ToUpper() + " ]')");
         tableNameisExistSql.Append("AND type in (N'U')");
         DataTable dt = UserDataAccess.ExecuteDataSet(tableNameisExistSql.ToString());
         if (dt.Rows.Count > 0)
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }