Populate DataTable rows as it come?

M

mtczx232

when the connection is slow, or in some situation of heavy query,
the Microsoft SQL server studio 2005 put first rows
as it come, and continue execute query until end
(I supposed it is done by cursor not by Top x ).

this behavior well-known in cursor connection like old ADO.

I look after example of code that make this for ADO.NET by populate
Datatable
by DataReader?
 
M

mtczx232

It's mean that i can use with the datatable.rows that already came from
server
befor all record load into DataTable?
 
S

Sahil Malik [MVP C#]

How can you use DataTable's rows without loading them?? No you can't.

SM
 
M

mtczx232

why we cannot load records in background as it come from slow network,
and
show the first records on the DataGrid, while background thread
continue
read records that come from stream?
like we do in MSAccess or SQL Management studio result grid.
 
S

Sahil Malik [MVP C#]

Because when you call DataAdapter.Fill(DataTable) <-- This method doesn't
work Asynchronously.

What you need is a DataReader, not DataTable.

SM
 
M

mtczx232

so we need DataGridView binding to datetable that receive his data
Asynchronous by Datareader with mean of ability to view the records
that already come. have some example for that?
 
M

mtczx232

Cor
Bingo! i looking so much time after your code.

if you can answer me little more:

*why you not use with this in situation of large Data or slow
connection?
*the above reply claim thet new 2.0 ADO.NET Method "DataTable.Load" do
this job, that true?

*I have another Q that i not get Answer about DataGrid/View, maybe you
can answer me. I run for test DataAdepter fill with 819,000 records in
30 sec,
but the biding after it to DataGrid (or DataGridview by coding
MyGrid.datasource=MyTbl)
take about 90 sec. the RAM of App grow after fill to 333M and after
biding is take more 35M.
My Q is: i want to know what biding operation do so much? according my
opinion, the only job,
is to put on the screen the first record, and for this not have between
10 rows to 900,000 rows?

thanks
 
M

mtczx232

This approach is true in lot of situations but it's need more coding. I
not yet
learn your example of paging.

But you can agree with me that have some situation that right approach
is to build ability of fill datagrid as data come. for example take App
like SQL Analyzer (SQL Managment studio), that utilize in many cases
to investigate Data, the user not have Idea how Query that, and he try.
then he not have idea about how many records return by his Q, or how
it is complicate to execute it. in this situation is it very utilize to
get
records to Grid in background, while user able to use with records
that already processed.

So after all, I wander if this approach can done by some trick on
ADO.NET.
your Example indeed is contain lot of interesting tech. it's intended
to
give us Progressbar. i try to change it, and I move binding code
before reading Data, and I got what i want. the data come while
i can see the records.

But, the problem is, that I not find a way, to force the binding to
Ignore from
Add each single records to prevent flicker.

So my Q again way datagridview painted itself entirely for each records
Add. for my opinion, the only ScrollBar is need to repaint.
and if have a way to Force Binding to not refrash until I Call it.
 
M

mtczx232

Cor
I try your paging Ex from:
http://www.vb-tips.com/default.aspx?ID=79afdb6a-611d-43cd-9186-def86a...


it's very nice with select that not have order-by

did you know how Dotnet make paging, is do that by NTile?

unfortunity the your old Example for paging by Ntile is delete from
your Website.
so i go to SQL2005 doc, and i see that this function intend to Numberin
records,
and not have any benefits for repaging performance.

I try with MSAccess (with old mode, not in project mode) to open table
with 3 million records. even the order-by not have a Key, then table
open
with second. the Paging with Dotnet Paging with your example with Key
order by, is take a long minutes!!

So I don't want to argue if the need "Open large table to browse" is
necessarily
or not. but MSAccess (cursor) do that excellent and Paging by Dotnet is
performance not acceptable.

if have someone with another experience please note me.
 

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