title: How to Fill a DataSet with TableMapping instead of TableName
body: <p>According to msdn <a href="http://msdn.microsoft.com/en-us/library/ks92fwwh.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/ks92fwwh.aspx</a></p>
  
  <blockquote>
    <p>The DataTableMapping name can be
    passed in place of the DataTable name
    to the Fill method of the DataAdapter.</p>
  </blockquote>
  
  <p>The code below is with TableName "Employee"</p>
  
  <pre><code>using System;
  using System.Collections.Generic;
  using System.Data;     
  using System.Data.Common;
  using System.Data.OleDb;
  
  public class MyClass
  {
      public static void Main()
      {
      OleDbConnection mySqlConnection =new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\data\nwind.Mdb");
  
      OleDbCommand mySqlCommand = mySqlConnection.CreateCommand();
      mySqlCommand.CommandText = "SELECT EmployeeID, FirstName, LastName " +
        "FROM Employees AS Emp " +
        "WHERE EmployeeID = 9";
      OleDbDataAdapter mySqlDataAdapter = new OleDbDataAdapter();
      mySqlDataAdapter.SelectCommand = mySqlCommand;
      DataSet myDataSet = new DataSet();
  
      DataTableMapping myDataTableMapping = mySqlDataAdapter.TableMappings.Add("Employees", "dtEmployee");
  
      Console.WriteLine("myDataTableMapping.DataSetTable = " + myDataTableMapping.DataSetTable);
      Console.WriteLine("myDataTableMapping.SourceTable = " + myDataTableMapping.SourceTable);
  
      myDataTableMapping.ColumnMappings.Add("EmployeeID", "dtEmployeeId");
      mySqlConnection.Open();
      mySqlDataAdapter.Fill(myDataSet, "Employee");
      mySqlConnection.Close();    
  
      DataTable myDataTable = myDataSet.Tables["dtEmployee"];
      foreach (DataRow myDataRow in myDataTable.Rows)
      {
        Console.WriteLine("ID = " + myDataRow["dtEmployeeId"]);
        Console.WriteLine("FirstName = " + myDataRow["FirstName"]);
        Console.WriteLine("LastName = " + myDataRow["LastName"]);
      }   
          Console.ReadLine();
      }
  
  }
  </code></pre>
  
  <p>If I pass "dtEmployee" in Fill</p>
  
  <pre><code>mySqlDataAdapter.Fill(myDataSet, "dtEmployee");
  </code></pre>
  
  <p>It says dtEmployeeId doesn't belong to datatable dtEmployee !
  How can I use my ColumnMappings then ?</p>