I'm using MySqlDataAdapter.Fill to fill a DataSet like this:
publicstaticDataSetRetrieveDataSet(stringconnectionString, stringstoredProcedure, paramsMySqlParameter[] parameters)
{
using (MySqlConnectionconn=newMySqlConnection(connectionString))
{
conn.Open();
using (MySqlCommandcomm=conn.CreateCommand())
{
comm.CommandText=storedProcedure;
comm.CommandType=CommandType.StoredProcedure;
if (parameters!=null&¶meters.Length>0)
{
comm.Parameters.AddRange(parameters);
}
using (MySqlDataAdapteradapter=newMySqlDataAdapter(comm))
{
DataSetdata=newDataSet();
adapter.Fill(data);
returndata;
}
}
}
}
My stored procedure returns 4 result sets. In the case that result set 4 (the last one) is empty, the data.Tables.Count equals 3. In the case that result set 4 has rows, data.Tables.Count equals 4. In the case that result set 2 has no rows, data.Tables.Count equals 4 still.
So it seems like if the last result set is blank, it is not being included as a table in the dataset. My guess is that this is a for loop error, but I couldn't identify it from the code of MySqlDataAdapter.
The text was updated successfully, but these errors were encountered:
Can repro with the test data set up in StoredProcedureFixture:
using (varcommand=newMySqlCommand("multiple_result_sets", connection))
{
command.CommandType=CommandType.StoredProcedure;
command.Parameters.AddWithValue("pivot", 8);
using (MySqlDataAdapteradapter=newMySqlDataAdapter(command))
{
DataSetdata=newDataSet();
adapter.Fill(data);
Console.WriteLine(data.Tables.Count); // prints 1, should be 2
}
}
I'm using MySqlDataAdapter.Fill to fill a DataSet like this:
My stored procedure returns 4 result sets. In the case that result set 4 (the last one) is empty, the data.Tables.Count equals 3. In the case that result set 4 has rows, data.Tables.Count equals 4. In the case that result set 2 has no rows, data.Tables.Count equals 4 still.
So it seems like if the last result set is blank, it is not being included as a table in the dataset. My guess is that this is a for loop error, but I couldn't identify it from the code of MySqlDataAdapter.
The text was updated successfully, but these errors were encountered: