whats wrong with this code ? i want populate all users in datagridview1 but datagirdview showing nothing .
private void button4_Click( object sender, EventArgs e )
{
dataGridView1.AutoGenerateColumns = true;
dataGridView1.DataSource = db.todosUsuario("select usuario from usuarios");
}
//DB class
public DataSet todosUsuario(string query)
{
DataSet dt= new DataSet();
try
{
MySqlConnection cnn = new MySqlConnection(MysqlConnect());
cnn.Open();
MySqlDataAdapter da = new MySqlDataAdapter(query, cnn);
da.Fill(dt,"Usuario");
cnn.Close();
}
catch(Exception ed)
{
MessageBox.Show(ed.ToString());
}
return dt;
}