compact framework timeou
Posted: Sat 05 Nov 2005 04:18
I'm having a problem with unstable internet access with the MySQLDirect Mobile connector. I understand that if something goes wrong in the MySqlConnection or MySqlCommand classes, an exception is thrown. The problem is that once that exception is thrown, the connection's state stays Open. I need a way to reset it, so I use connection.Close(). Unfortunately this takes forever before it is successfully executed.
Also if I do connection.Open() it takes forever if the internet isn't available. Here is the code in question. It takes a long time both at open and at close, much longer than the 1 second it's supposed to take. Any suggestions?
connection.UserId = user;
connection.Password = pass;
connection.Host = host;
connection.Port = 3306;
connection.Database = database;
connection.ConnectionTimeout = 1;
commander.CommandTimeout = 1;
//commander.
try{
connection.Open();
CoreLab.MySql.MySqlDataReader dataReader = commander.ExecuteReader();
while (dataReader.Read()) {
output.Text = dataReader.GetString(0);
}
dataReader.Close();
}
catch(Exception ex ){
output.Text = "Bad Internet" ;
}
connection.Close();
Also if I do connection.Open() it takes forever if the internet isn't available. Here is the code in question. It takes a long time both at open and at close, much longer than the 1 second it's supposed to take. Any suggestions?
connection.UserId = user;
connection.Password = pass;
connection.Host = host;
connection.Port = 3306;
connection.Database = database;
connection.ConnectionTimeout = 1;
commander.CommandTimeout = 1;
//commander.
try{
connection.Open();
CoreLab.MySql.MySqlDataReader dataReader = commander.ExecuteReader();
while (dataReader.Read()) {
output.Text = dataReader.GetString(0);
}
dataReader.Close();
}
catch(Exception ex ){
output.Text = "Bad Internet" ;
}
connection.Close();