我试图为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);
}