Datagrid binding

A

Ashwani Gaur

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
simultaneously.

In vb.net 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
started.

Thanks,
Ashwani.
 
C

Cor

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
"Where"

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)
mydatadapter.fill(mydataset)
///

I hope this helps

Cor
 
A

Ashwani Gaur

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.

Thanks,
Ashwani.
 
C

Cor

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?

Cor
 
K

Ken Tucker [MVP]

Hi,

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

Ken
----------------
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top