|
dev
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
Populate DataTable rows as it come?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? That's actually the default behavior of a DataReader, it streams in the rows
as they come acros the wire. You can use the Load method http://msdn2.microsoft.com/en-us/library/system.data.datatable.load(VS.80).aspx to accomodate this... <mtczx***@yahoo.com> wrote in message Show quote news:1141219225.908061.131670@e56g2000cwe.googlegroups.com... > 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? > Yes (assuming I understood his Q) - and the streaming behavior is 100%
customizable. - Sahil Malik [MVP] ADO.NET 2.0 book - http://codebetter.com/blogs/sahil.malik/archive/2005/05/13/63199.aspx ---------------------------------------------------------------------------- Show quote "W.G. Ryan - MVP" <WilliamRyan@nospam.gmail.com> wrote in message news:uXbzXaTPGHA.2888@tk2msftngp13.phx.gbl... > That's actually the default behavior of a DataReader, it streams in the > rows as they come acros the wire. You can use the Load method > http://msdn2.microsoft.com/en-us/library/system.data.datatable.load(VS.80).aspx > to accomodate this... > <mtczx***@yahoo.com> wrote in message > news:1141219225.908061.131670@e56g2000cwe.googlegroups.com... >> 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? >> > > It's mean that i can use with the datatable.rows that already came from
server befor all record load into DataTable? How can you use DataTable's rows without loading them?? No you can't.
SM <mtczx***@yahoo.com> wrote in message Show quote news:1141239581.994125.29560@p10g2000cwp.googlegroups.com... > It's mean that i can use with the datatable.rows that already came from > server > befor all record load into DataTable? > 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. Because when you call DataAdapter.Fill(DataTable) <-- This method doesn't
work Asynchronously. What you need is a DataReader, not DataTable. SM <mtczx***@yahoo.com> wrote in message Show quote news:1141248473.293115.245960@u72g2000cwu.googlegroups.com... > 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. > 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? mtczx.
You can load a datatable using a datareader. http://www.vb-tips.com/default.aspx?ID=49f2cff5-56ad-44fc-a4c6-fc0d5c470f53 However in my opinion because of dependency reasons absolute withouth sense. (I made this sample more to show that it is not impossible, I will never use it) Cor <mtczx***@yahoo.com> schreef in bericht Show quote news:1141286366.646112.234950@j33g2000cwa.googlegroups.com... > 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? > 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 Mtczx.
Just simple answered all in one. If a user needs data than you can be almost sure that there is a dependency. If the user has first to search for that data, than I would use paging, Have than a look to one of the paging samples on our website. http://www.vb-tips.com/default.aspx?ID=79afdb6a-611d-43cd-9186-def86a1baeef I hope this helps, Cor <mtczx***@yahoo.com> schreef in bericht Show quote news:1141290241.741091.171310@v46g2000cwv.googlegroups.com... > 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 > 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. 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. mtczx
These two samples are from Ken, I asked him to put the Ntile again on the website and he did. http://www.vb-tips.com/default.aspx?ID=da78342b-9e47-4e81-916f-ba7a1d82b540 I hope this helps, Cor <mtczx***@yahoo.com> schreef in bericht Show quote news:1141549267.096792.191750@e56g2000cwe.googlegroups.com... > 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. > |
|||||||||||||||||||||||