What does MySqlDataAdapter.Fill return when the results are empty?

Posted by Brian on Stack Overflow See other posts from Stack Overflow or by Brian
Published on 2010-03-11T20:00:42Z Indexed on 2010/03/11 20:04 UTC
Read the original article Hit count: 241

Filed under:
|

I have a 'worker' function that will be processing any and all sql queries in my program. I will need to execute queries that return result sets and ones that just execute stored procedures without any results. Is this possible with MySqlDataAdapter.Fill or do I need to use the MySqlCommand.ExecuteNonQuery() method? Here is my 'worker' function for reference:

private DataSet RunQuery(string SQL)
    {
        MySqlConnection connection;
        MySqlCommand command;
        MySqlDataAdapter adapter;
        DataSet dataset = new DataSet();

        lock(locker)
        {
            connection = new MySqlConnection(MyConString);
            command = new MySqlCommand();
            command = connection.CreateCommand();
            command.CommandText = SQL;
            adapter = new MySqlDataAdapter();
            adapter.Fill(dataset);
        }

        return dataset;
    }

© Stack Overflow or respective owner

Related posts about c#

Related posts about mysql