mrnugger
Member
- Joined
- Aug 20, 2006
- Messages
- 6
Ive been trying to make asynchronous connections, everything runs smoothly up to the EndExecuteReader(), it isnt returning any results.
Before you take a look at the code, any documentation on .NET connector and using these asynchronous function would be appreciated, Ive found ZERO documentation on asynchronous MySQL methods using C# and the provided connector.
Here is the code of the method Im trying to write:
It returns Object is null exception on the variable reader. It seems the line "command.EndExecuteReader(result);" isnt returning anything.
Before you take a look at the code, any documentation on .NET connector and using these asynchronous function would be appreciated, Ive found ZERO documentation on asynchronous MySQL methods using C# and the provided connector.
Here is the code of the method Im trying to write:
Code:
public int getLogin(string name, string password)
{
MySqlConnection connection = new MySqlConnection(connectionString);
MySqlCommand command = new MySqlCommand("select * from players where name = " + name
+ " and password = " + password + "");
connection.Open();
MySqlDataReader reader = null;
IAsyncResult result = command.BeginExecuteReader();
while(!result.IsCompleted)
{
// while it isnt completed, wait.
}
if (result.IsCompleted)
{
reader = command.EndExecuteReader(result);
}
return 0;
}