Datagrid binding

Datagrid binding

Post by Ashwani Ga » Sat, 27 Dec 2003 18:11:32

Hi all,

It may be a very simple query, but i am stuck with having
millions of record showing instantly in chunks of 100 or
200 record(not a paging concept), in vb i use to bind the
data to ado datacontrol which is binded to datagrid and
data is instantly shown using ado events and methods in a
user friendly manner i.e data is shown and fetched

In if i am using dataset and binding that dataset
to grid, the data is not shown till all the records are
fetched and i don't know how to bind it to datareader,
also i don't know how to use threads to achieve this, can
anyone help me out with some piece of code to get me


Datagrid binding

Post by Cor » Sat, 27 Dec 2003 18:35:25

Hi Ashwani,

Making a dataset of all your records is in my opinion not the right way,
You can make smaller tables using by instance in the select clause the

One of the posibilities is let the user first select it using a combobox
where you only did fill a dataset with the showmember and the keyfields from
a parent database table

Just a thought, but there are of course thousands of other ways.

I don't think that using the datareader will help you much further, you have
to do a lot of work yourself
- making the dataset
- making the datatable
- making the columns
- creating the keys
- read all rows
- filling item by item all the rows
- add the rows to the table
and all I forget.
And then I think the result will be the same.

If you don't know how to create a dataset with a fill, that is roughly
written as pseudo
dim mydataset as new dataset
(connection, dataadapter, and commandbuilder need a prefix as Oledb or SQL)
dim myconnection as new connection("connectionstring")
dim mydataadapter as new dataAdapter("MySQLWhereString",myconnection)

I hope this helps



Datagrid binding

Post by Ken Tucker » Sat, 27 Dec 2003 20:17:52



Datagrid binding

Post by Ashwani Ga » Sat, 27 Dec 2003 20:33:53

Hi Cor,

Thanks for your reply, paging option you suggested is my
last option, i want my application to be user friendly
then processor friendly, i.e. when user presses some
button suppose Load Data, the grid starts filling with
data, that data could either come from dataset or
datareader and simultaneouly user will be able to see the
progress of data fetch by means of some message or so that
this many record have been fetched, user may also be able
to stop the fetch when some particular amount of data have
been fetched.

Any Help.

the right way,
select clause the
using a combobox
the keyfields from
other ways.
much further, you have
that is roughly
prefix as Oledb or SQL)

Datagrid binding

Post by Cor » Sat, 27 Dec 2003 21:12:07

Hi Ken,

Are you sure of that link you gave?

There are 2 answers,
One gives 2 lines of how to make a dataset from a reader while I did give
almost all so that was not the meaning of your message.

The other binds a datareader to a datagrid.datasource, while the
documentation say it has to be a iList

What do I see wrong?


Datagrid binding

Post by Ken Tucker » Sat, 27 Dec 2003 21:48:12


Your right. I tried the bottom it does not work. I should have
checked it first.