MySQL Forums
Forum List  »  Partners

Lost connection to mysql
Posted by: abhijeet kumar
Date: July 05, 2007 05:47AM

I am using godaddy deluxe hosting plan.
I am facing this error very often.
error- Lost connection to MySQL server during query

Following is sample code of the page i am using.

on page upload i m populating a drop down box.
cmd = new OdbcCommand(sql, new OdbcConnection(GetConnectionString()));
cmd.Connection.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection);
while (dr.Read())
{
DropDownList1.Items.Add(Convert.ToString(dr["column_name"]));
}
dr.Close();
cmd.Connection.Close();
cmd.Dispose();

After that on button click I am querying mysql in following way:
cmd = new OdbcCommand(sql1, new OdbcConnection(GetConnectionString()));
cmd.Connection.ConnectionTimeout = 600;
//cmd = new MySqlCommand("GET_INPUT_PROVIDERS", new MySqlConnection(GetConnectionString()));
//cmd.CommandType = CommandType.StoredProcedure;
//cmd.Parameters.Add(new MySqlParameter("PARAM",Para_district));
cmd.Connection.Open();
dr = cmd.ExecuteReader(CommandBehavior.CloseConnection); //error comes here
Int32 i = 0;
while (dr.Read())
{
// my code
}

dr.Close();
cmd.Connection.Close();
cmd.Dispose();

And when i run the page I get lost connection during query as an error.

Can anybody help me?
I donot have access to any settings.php file or so....:(

thanks

Options: ReplyQuote


Subject
Written By
Posted
Lost connection to mysql
July 05, 2007 05:47AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.