i Guys , I created a form windows software you need to access an online database to read and write some records, always tested the software with a mysql database on my own computer and everything worked well, I decided to put the online bank as it had a plan hostgator. I upei the bank and created a user to acess it but when trying to connect with Visual Studio 2010 or by string if connection or VS server explorer's own always get the message:
MySql Error: "Got packets out of order".
Remembering that my bank is properly configured with user related to the bank, and I'm doing tests with all permissions. I've tried to ssh clients and other sql and all right customers, the problem seems to be the connection that visual studio does. Here is an excerpt of my code, how to use the connection string:
using (var con = new MySqlConnection("SERVER=XXX.XXX.XXX.XXX; DATABASE=nomeBancoDeDados; UID=nameUserDataBase; PASSWORD=passwordUserDataBase"))
{
using (var cmd = new MySqlCommand("CommandMySqlHere", con))
{
try
{
con.Open();
}
catch (Exception ex)
{
throw new Exception("Erro de conexão: " + ex.Message);
}
using (var leitor = cmd.ExecuteReader())
{
if (leitor.HasRows)
{
while (leitor.Read())
{
}
con.Close();
leitor.Close();
}
else
{
leitor.Close();
con.Close();
MessageBox.Show("Not date result");
}
}
}
}
MySql Error: "Got packets out of order".
Remembering that my bank is properly configured with user related to the bank, and I'm doing tests with all permissions. I've tried to ssh clients and other sql and all right customers, the problem seems to be the connection that visual studio does. Here is an excerpt of my code, how to use the connection string:
using (var con = new MySqlConnection("SERVER=XXX.XXX.XXX.XXX; DATABASE=nomeBancoDeDados; UID=nameUserDataBase; PASSWORD=passwordUserDataBase"))
{
using (var cmd = new MySqlCommand("CommandMySqlHere", con))
{
try
{
con.Open();
}
catch (Exception ex)
{
throw new Exception("Erro de conexão: " + ex.Message);
}
using (var leitor = cmd.ExecuteReader())
{
if (leitor.HasRows)
{
while (leitor.Read())
{
}
con.Close();
leitor.Close();
}
else
{
leitor.Close();
con.Close();
MessageBox.Show("Not date result");
}
}
}
}