C#MySQL异步函数

时间:2015-12-24 17:50:12

标签: c# mysql asynchronous

我试图为MySQL编写一些异步函数,但文档很差,我找不到任何示例。任何人都可以解释这个功能或给出一个例子:

public void GetData(string commandText, Action<IAsyncResult> mySqlCallback)
{
    MySqlCommand command = mySqlConnection.CreateCommand();
    command.CommandText = commandText;

    IAsyncResult asyncResult = command.BeginExecuteReader();

    //return command.EndExecuteReader(asyncResult);
}

public void Execute(string commandText)
{
    MySqlCommand command = mySqlConnection.CreateCommand();
    command.CommandText = commandText;

    IAsyncResult asyncResult = command.BeginExecuteReader(0);

    command.EndExecuteReader(asyncResult);
}

0 个答案:

没有答案