# Schema Details

## Content



The ADO.NET provider for OData supports schema discovery using ADO.NET classes or SQL statements to the system tables. This is done through the [GetSchema](/componentone/api/services/online-dataconnector/dotnet-standard-api/C1.AdoNet.CSV/C1.DataConnector.AdoNet.C1ConnectionBase.GetSchema.html) method of the [C1ODataConnection](/componentone/api/services/online-dataconnector/dotnet-standard-api/C1.AdoNet.OData/C1.AdoNet.OData.C1ODataConnection.html) class, optionally specifying schema name and restriction values.

In the code example below, the **GetSchema** method is called firstly to return the Tables of the database, then called again to return the Columns of a specific datatable.

```csharp
using (var connection = new C1ODataConnection(connstr))
{
    connection.Open();
    // Get a list of tables
    DataTable databaseTables = connection.GetSchema("Tables");
    Console.WriteLine("List of Tables in database:\n");
    foreach (DataRow row in databaseTables.Rows)
    {
        // Print table names
        Console.WriteLine(row["TableName"]);
    }
    // Get column names in a table
    DataTable datatableColumns = connection.GetSchema("Columns", new string[] { "Products" });
    Console.WriteLine("\n Products table columns:");
    foreach (DataRow column in datatableColumns.Rows)
    {
        // Print column properties
        Console.Write(column["ColumnName"]);
        Console.Write("\t" + column["DataType"]);
        Console.Write("\t" + column["AllowDbNULL"] + "\n");
    }
}
```

Alternatively to the **GetSchema** method, the [GetSchemaTable](/componentone/api/services/online-dataconnector/dotnet-standard-api/C1.AdoNet.OData/C1.AdoNet.OData.C1ODataDataReader.GetSchemaTable.html) method of the **C1DataReader** class can be used, which returns a DataTable with the definitions of the column metadata.