How can I display the result of a DataReader in a DataGridView?

  • Thread starter Thread starter Jorge EA
  • Start date Start date
J

Jorge EA

Hi there,

I am using VC# Express (beta 1) and as the subject says, here's what I am
trying to do:

FbConnection conn = new FbConnection(conn_str);
FbCommand cmd = new FbCommand("select numero,nombre,ciudad from
clientes", conn);

conn.Open();

FbDataReader myReader;
myReader=cmd.ExecuteReader();

dgvResultados.DataSource = myReader;
myReader.Close();

myReader has data, I can see it with a MessageBox.Show(), however, the
DataGridView shows nothing at all. Using the ASP grid, this works. Am I
missing something to make it work in WindowsForms as well?

Thanks in advance,

-Jorge

I
 
Hello Jorge,

DataReader is a forward only stream, yo should use a DataApdater and
a DataSet for you to be able to display the data in the DataGridView
Saludos,
Javier.
 
Back
Top