I have the following problem to display the data in a gridView pulling from the MySQL database
public string CarregarAluno()
{
string retorno = "";
string sql = "select * from alunos";
MySqlConnection conn = CriarConexao();
MySqlCommand cmd = new MySqlCommand(sql, conn);
MySqlDataAdapter adapter = new MySqlDataAdapter(cmd);
DataTable data = new DataTable();
adapter.Fill(data);
try
{
conn.Open();
cmd.ExecuteNonQuery();
conn.Close();
retorno = "";
}
catch (MySqlException ex)
{ retorno = "Erro ao Carregar Grid: " + ex.Message; }
finally { if (conn.State == ConnectionState.Open) conn.Close(); }
return data;
}
The "return data;" is underlined with the following message: "Can not implicitly convert type System.Data.Data.Table to String"