1
I have the following problem to display the data in a pulling gridView of 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;
}
"Return data;" is underlined with the following message: "It is not possible to convert implicitly type System.Data.Data.Table into String "
date is a
DataTable
how do you want to return in a method that expects astring
? https://www.treinaweb.com.br/curso/csharp-basico– Rovann Linhalis