title: Accessing the Schema of an Access 2013 database
body: <p>If I try to read the schema of a Access 2013 database I receive the following error :</p>
  
  <pre><code>no read permission on 'MSysRelationships'
  </code></pre>
  
  <p>Now the help tells me that</p>
  
  <pre><code>User-level security features are not available in Access apps, web databases, 
  or databases that use one of the new file formats (.accdb, .accde, .accdc, .accdr).
  </code></pre>
  
  <p>=> How can I read the schema of that DB ?</p>
  
  <p>Edit :</p>
  
  <p>here is my code in Linqpad :</p>
  
  <pre><code>var stringBuilder = new OleDbConnectionStringBuilder();
  stringBuilder.Provider = "Microsoft.ACE.OLEDB.12.0";
  stringBuilder.DataSource = @"C:\Recommendations.accdb";
  
  using (var connection = new OleDbConnection(stringBuilder.ToString().Dump()))
  {
      connection.Open();
      var schemaTable = connection.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, new object[] {null, null, null, "TABLE"});
      var sheetName = schemaTable.AsEnumerable().Select(row =&gt; row.Field&lt;string&gt;("TABLE_NAME")).First();
      schemaTable.Dump();
  
      string  namesQuery = "SELECT DISTINCT szRelationship, szReferencedObject, szObject FROM MSysRelationships";
      string  namesQuery2 =  string.Format("select Name, Age from [{0}]", "Users");
  
      using (var command = new OleDbDataAdapter(namesQuery, connection))
      {
          var dataSet = new DataSet();
          command.Fill(dataSet, sheetName);
          dataSet.Dump();
      }
      connection.Close();
  }
  </code></pre>