473,698 Members | 2,466 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Best approach to filling table and loading to grid? Please help...

VM
If I wanted to load an ascii file (which contains 400,000+ lines and each
line is a table row) to a datatable and then display it to a datagrid, what
would the best approach be? I initially had a method that would fill the
table with the ascii file data (the parm was the fileName), it would return
the filled datatable, and then I'd use it as a datasource for the grid. That
was working well with small files but the client just told me that files
would normally contain between 400K-800K rows. So with my layout, the user
would have to wait until the method processes the whole file and attaches
the file to the grid before he/she can see anything. Is there a more
efficient way of doing it? Is there any way I can display some of the
records while the rest is being processed? My only concern there is what
datagrid event to use so I know that the user wants to look at more rows.
The other way I tried is by using delegates and instead of returning a
datatable it'll return a datarow. Unfortunately, it still turns out to be
very slow and its performance doesn't seem correct...

loadFileDelegat e LoadAuditFileTo Table = new
loadFileDelegat e(loadAuditFile ToTable);
BeginInvoke (LoadAuditFileT oTable, new object[] { sFileName});
loadAuditFileTo Table(sFileName );

private void loadAuditFileTo Table(string sFileName)
{
DataRow rowAudit;
ZMMatch.Audit zmAudit = new ZMMatch.Audit() ;
_table_auditAdd ress = zmAudit.openAZM (sFileName); //Opens ascii file and
prepares datatable
//dataGrid_auditA ddress.DataSour ce = _table_auditAdd ress;
bool isEndOfFile=fal se;
while (!isEndOfFile)
{
rowAudit = zmAudit.readAud itAZMFileToView (ref isEndOfFile, ref
iRowsProcessed) ; //it reads one line and converts to row
if (!isEndOfFile)
{
_table_auditAdd ress.Rows.Add(r owAudit);
ShowProgress();
}
}
delegate void ShowProgressDel egate();
private void ShowProgress()
{
if(dataGrid_aud itAddress.Invok eRequired == false )
{
dataGrid_auditA ddress.DataSour ce = _table_auditAdd ress;
//dataGrid_auditA ddress.Refresh( );
//Application.DoE vents();
}
else
{
ShowProgressDel egate showProgress = new
ShowProgressDel egate(ShowProgr ess);
BeginInvoke(sho wProgress, new object[] { });
}

}

Any help is appreciated since I'm really stuck with this and it's due Thurs.
morning...
Nov 16 '05 #1
0 1161

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
1270
by: Laphan | last post by:
Hi All I know the subject sounds strange, but please bear with me. Using ADO/ASP, I want to retrieve a list of pics from my db (which will be dynamic number of pics as a user will be uploading anything from 1 to 12 pics) and put them in a grid (table) of say 3 x 4 cells. I think this is easy to do if the user has uploaded 12 pics, as the recordset's recursive loop will create the table for me, but my problem is
12
3741
by: Aaron Smith | last post by:
What is the best way to handle data in a multiple user environment? We have forms that will allow users to add edit and delete data from a table on SQL server. The data could be edited on multiple machines at the same time. How do you keep the dataset constantly updated with changes made to the data? I'm playing with just calling the fill method, but it seems pretty unstable at times. Especially when deleting records, they don't seem to...
1
1192
by: Jeff User | last post by:
Hello all I need to build a web form that will allow user to enter database table column definitions. Each row on the form would contain column name, data type (chosen from a drop down list), size (if applicable) and other wonderful attributes. I will then take this input and build a CREATE table statement. I am using C# in vs2003, .net 1.1 I have been reading through several groups here to get ideas, but
2
1015
by: Jeff User | last post by:
Hello all I need to build a web form that will allow user to enter database table column definitions. Each row on the form would contain column name, data type (chosen from a drop down list), size (if applicable) and other wonderful attributes. I will then take this input and build a CREATE table statement. I am using C# in vs2003, .net 1.1 I have been reading through several groups here to get ideas, but
4
2428
by: Tarun Mistry | last post by:
Hi all, I have posted this in both the c# and asp.net groups as it applies to both (apologies if it breaks some group rules). I am making a web app in asp.net using c#. This is the first fully OO application I will be making, also my first .NET application, so im looking for any help and guidance. Ok, my problems are todo with object and database abstraction, what should i do.
2
1637
by: Bob | last post by:
I got three related datagrid views one parent and two children of the same. The two child tables contain many thousands of records and some of the contents are bitmap files in a sql server database. The default behaviour of loading all the contents of the parent data table and also all the related data is not acceptable, its takes too long to complete. What I need to do IMHO, is to load the parent table and after its loaded, and it gets...
16
2805
by: Rex | last post by:
Hi All - I have a question that I think MIGHT be of interest to a number of us developers. I am somewhat new to VIsual Studio 2005 but not new to VB. I am looking for ideas about quick and efficient navigating within Visual Studio 2005. Let's say your project (or solution) has dozens of forms and hundreds or even thousands of routines. Two Questions: 1) BUILT-IN to Visual Studio 2005. What ideas do you have to quickly
2
2172
by: VMI | last post by:
I'm filling up a gridview and the underlying datatable has about 30,000 records, so it takes some time before I can see the page again with the records on the gridview. Is there any type of threading (or anything else) that I can use so that I can display some message (i.e. "Grid loading...") or any way so that I can start viewing the records? Thanks.
2
1899
by: VMI | last post by:
I'm filling up a gridview and the underlying datatable has about 30,000 records, so it takes some time before I can see the page again with the records on the gridview. Is there any type of threading (or anything else) that I can use so that I can display some message (i.e. "Grid loading...") or any way so that I can start viewing the records? Thanks.
0
8609
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9166
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9030
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
7737
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6525
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5861
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4621
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3052
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2007
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.