Beispiel #1
0
 /// <summary>
 /// Gets column schema information about an OLE table
 /// </summary>
 /// <param name="tableName">Name of the table</param>
 /// <returns>DataTable with schema information</returns>
 public override DataSets.ANSI.TableColumnSchema.ColumnsDataTable GetTableColumnSchemaANSI(string tableName)
 {
     try
     {
         DataTable table = this.GetSchema("Columns", tableName);
         // IS_NULLABLE and DATA_TYPE are different data types for non OleDb DataTables.
         DataSets.ANSI.TableColumnSchema tableColumnSchema = new Epi.DataSets.ANSI.TableColumnSchema();
         tableColumnSchema.Merge(table, false, MissingSchemaAction.Ignore);
         return tableColumnSchema.Columns;
     }
     catch (Exception ex)
     {
         throw new GeneralException("Could not get table column schema for " + tableName + ".", ex);
     }
 }
Beispiel #2
0
        /// <summary>
        /// Gets column schema information about an OLE table
        /// </summary>
        /// <param name="tableName">Name of the table</param>
        /// <returns>DataTable with schema information</returns>
        public override DataSets.ANSI.TableColumnSchema.ColumnsDataTable GetTableColumnSchemaANSI(string tableName)
        {
            OleDbConnection conn = this.GetNativeConnection();

            try
            {
                OpenConnection(conn);
                DataTable dt = conn.GetOleDbSchemaTable(OleDbSchemaGuid.Columns, new object[] { null, null, tableName, null });
                DataSets.ANSI.TableColumnSchema schema = new Epi.DataSets.ANSI.TableColumnSchema();
                schema.Merge(dt);
                return schema.Columns;
            }
            catch (Exception ex)
            {
                throw new GeneralException("Could not get table column schema for." + tableName, ex);
            }
            finally
            {
                CloseConnection(conn);
            }
        }