title: DataAdapter returns a empty rowset, but DataReader returns data
body: <p>I execute a query that calls a SP, that SP returns data... but when I call it with a DataAdapter I get no result data, if use a DataReader instead... then I get data. The database is SQL Server and the code is using OleDb for reasons I cannot change.</p>
  
  <p>These two calls returns diferent things:</p>
  
  <pre><code>    String commandText = "Declare @return_value int;  exec dbo.copyTemplate ? , ? , ? , ? , ? ,  ? ,   ?, Null , 0 , @return_value;";
  
      Console.WriteLine("Data Adapter");
      using (OleDbConnection con = new OleDbConnection(connectionString))
      {
          using (OleDbDataAdapter da = new OleDbDataAdapter(commandText, con))
          using (DataTable table = new DataTable("table"))
          {
              da.SelectCommand.Parameters.AddWithValue("?",9).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", "AAAAB").DbType = DbType.String;
              da.SelectCommand.Parameters.AddWithValue("?", 1).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", 1).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", 2).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", true).DbType = DbType.Boolean;
              da.SelectCommand.Parameters.AddWithValue("?", DateTime.Now.Date).DbType = DbType.DateTime;
  
              da.Fill(table);
  
              foreach (DataRow dr in table.Rows)
              {
                  foreach (DataColumn dc in table.Columns)
                  {
                      Console.Write(dr[dc].ToString());
                      Console.Write(" ");
                  }
                  Console.WriteLine();
              }
          }
      }
      Console.WriteLine("Data Reader");
      using (OleDbConnection con = new OleDbConnection(connectionString))
      {
          using (OleDbCommand cmd = new OleDbCommand(commandText, con))
          {
              cmd.Parameters.AddWithValue("?", 9).DbType = DbType.Int32;
              cmd.Parameters.AddWithValue("?", "AAAAC").DbType = DbType.String;
              cmd.Parameters.AddWithValue("?", 1).DbType = DbType.Int32;
              cmd.Parameters.AddWithValue("?", 1).DbType = DbType.Int32;
              cmd.Parameters.AddWithValue("?", 2).DbType = DbType.Int32;
              cmd.Parameters.AddWithValue("?", true).DbType = DbType.Boolean;
              cmd.Parameters.AddWithValue("?", DateTime.Now.Date).DbType = DbType.DateTime;
  
              con.Open();
  
              using (OleDbDataReader reader = cmd.ExecuteReader())
                  while (reader.Read())
                  {
                      for (int i = 0; i &lt; reader.FieldCount; i++)
                      {
                          Console.Write(reader.GetValue(i) ?? "null");
                          Console.Write(" ");
                      }
                      Console.WriteLine();
                  }
          }
      }
  
      Console.ReadKey(true);
  </code></pre>
  
  <p>This code returns:</p>
  
  <pre><code>Data Adapter
  Data Reader
  1057
  </code></pre>
  
  <p>I can call this code hundreds of times and I always get a value in Data Reader a nothing in Data Adapter, and I can have whatever in the second parameter, it doesn't change anything in the result of the SP. I could swap the parameter values between the two calls, or alter the order... and the result would be still the same :(</p>
  
  <p>I don't understand why is this happening.</p>
  
  <p>Has anybody any idea about what could be the problem?</p>
  
  <p>Cheers.</p>
  
  <p><strong>UPDATE</strong>: If I fill a DataSet instead a DataTable I get the result:</p>
  
  <pre><code>    Console.WriteLine("Data Adapter with DataSet");
      using (OleDbConnection con = new OleDbConnection(connectionString))
      {
          using (OleDbDataAdapter da = new OleDbDataAdapter(commandText, con))
          using (DataSet ds = new DataSet("table"))
          {
              da.SelectCommand.Parameters.AddWithValue("?",9).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", "AAAAB").DbType = DbType.String;
              da.SelectCommand.Parameters.AddWithValue("?", 1).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", 1).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", 2).DbType = DbType.Int32;
              da.SelectCommand.Parameters.AddWithValue("?", true).DbType = DbType.Boolean;
              da.SelectCommand.Parameters.AddWithValue("?", DateTime.Now.Date).DbType = DbType.DateTime;
  
              da.Fill(ds);
  
              foreach (DataTable table in ds.Tables)
                  foreach (DataRow dr in table.Rows)
                  {
                      foreach (DataColumn dc in table.Columns)
                      {
                          Console.Write(dr[dc].ToString());
                          Console.Write(" ");
                      }
                      Console.WriteLine();
                  }
          }
      }
  </code></pre>
  
  <p>But the DataSet contains only one table, so I still don't understand why DataAdapter.Fill(DataTable) is not working.</p>