Link to home
Start Free TrialLog in
Avatar of SETP
SETP

asked on

SQL Query

In VB.NET 2003, I have an OldDbCommand that returns certain records of an Access database table. What is the simplest way of showing this in a DataGrid?

The OleDbCommand can return a a Scalar value which is no good since I am returning a couple of columns.
It can return a DataReader, but I can't bind that to a DataGrid
It can return nothing - again no good.

Is there no way to get it to return a table or an array which can then be bound to the datagrid? Or will I have to use it's Fill method to popualte a DataSet and then bind the DataSet to the DataGrid?

Thanks
ASKER CERTIFIED SOLUTION
Avatar of Bob Learned
Bob Learned
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
While it can work, the DataReader is a forward-only view, and doesn't provide the "best" method of binding to a DataGrid.

Bob
Avatar of tusharashah
tusharashah

Absolutely correct. As DataReader object can't be serialized, you'll have problem if you want to Add Some Inbuilt functionality to DataGrid. But, it's one of the straight fwd and easy way of Populating Grid.

-tushar
And, light-weight, too :)  Less overhead, and faster, but not as much functionality.

Bob