jeudi 2 avril 2015

display data from my database using dataGridView?

I want to display data from my database using dataGridView, but I am not getting the desired result. It's showing blank spaces in the table when I run the code. Here is the code:



MySqlCommand cmd = new MySqlCommand(query, ca.getConnection());
cmd.CommandType = CommandType.Text;
MySqlDataAdapter MyAdapter = new MySqlDataAdapter(cmd);
DataSet dSet = new DataSet();
MyAdapter.Fill(dSet);
dataGridView1.DataSource = dSet.Tables[0];

Aucun commentaire:

Enregistrer un commentaire