Home All Groups Group Topic Archive Search About

Removing rows from a DataTable is VERY slow

Author
30 Nov 2004 8:27 AM
Markus Hjärne

I'm using a DataTable to hold a selection of rows (100,000+) from a large
database table (1,000,000+ rows). At times I want to remove rows that aren't
used anymore from the DataTable to save memory. But my tests shows that it
takes very long time to remove the rows. Running the code below on a Pentium
2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000 rows,
but 32s (seconds, that is!) to remove half of them.

Can anybody tell me what I'm doing wrong or an alternative, faster way to do
this?

// Create table with one int column
DataTable table = new DataTable();
table.Columns.Add(
new DataColumn(
  "Col1",
  typeof(int)
)
);

// Add a number of rows to the table
int ticks = Environment.TickCount;
for (int i = 0; i < 100000; i++)
{
table.Rows.Add(new object[] {i});
}
int elapsed = Environment.TickCount - ticks;
MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
ms.");

// Create a list of rows to remove (half of those in table)
ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
for (int i = 0; i < table.Rows.Count; i++)
{
if ((i % 2) == 0)
  rowsToRemove.Add(table.Rows[i]);
}

// Remove the rows from the table
ticks = Environment.TickCount;
for (int i = 0; i < rowsToRemove.Count; i++)
{
table.Rows.Remove((DataRow)rowsToRemove[i]);
}
elapsed = Environment.TickCount - ticks;
MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed + "
ms.");

Grateful for any help on this,

Markus Hjarne
Author
30 Nov 2004 11:13 AM
Deepak
Indexing engine for DataTable in ADO.NET 1.x is not very optimized, thus you
facing this issue.
It has been re-written in ADO.NET 2.0, and will do these operations much
faster. I believe there is nothing much you can do about this. Storing your
data in multiple data tables will boost performance, but you will have to
access this based on your requirements.

--
Regards,

Deepak
[I Code, therefore I am]

Show quoteHide quote
"Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
news:uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl...
> I'm using a DataTable to hold a selection of rows (100,000+) from a large
> database table (1,000,000+ rows). At times I want to remove rows that
> aren't
> used anymore from the DataTable to save memory. But my tests shows that it
> takes very long time to remove the rows. Running the code below on a
> Pentium
> 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000 rows,
> but 32s (seconds, that is!) to remove half of them.
>
> Can anybody tell me what I'm doing wrong or an alternative, faster way to
> do
> this?
>
> // Create table with one int column
> DataTable table = new DataTable();
> table.Columns.Add(
> new DataColumn(
>  "Col1",
>  typeof(int)
> )
> );
>
> // Add a number of rows to the table
> int ticks = Environment.TickCount;
> for (int i = 0; i < 100000; i++)
> {
> table.Rows.Add(new object[] {i});
> }
> int elapsed = Environment.TickCount - ticks;
> MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
> ms.");
>
> // Create a list of rows to remove (half of those in table)
> ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> for (int i = 0; i < table.Rows.Count; i++)
> {
> if ((i % 2) == 0)
>  rowsToRemove.Add(table.Rows[i]);
> }
>
> // Remove the rows from the table
> ticks = Environment.TickCount;
> for (int i = 0; i < rowsToRemove.Count; i++)
> {
> table.Rows.Remove((DataRow)rowsToRemove[i]);
> }
> elapsed = Environment.TickCount - ticks;
> MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed +
> "
> ms.");
>
> Grateful for any help on this,
>
> Markus Hjarne
>
>
Are all your drivers up to date? click for free checkup

Author
1 Dec 2004 7:16 AM
Markus Hjärne
Thanks for yor reply,

can you tell me what's your source of information when you say that the
indexing engine has been re-written i ADO.NET 2.0?

Regards,

Markus

Show quoteHide quote
"Deepak" <kapoordee***@gmail.com> skrev i meddelandet
news:%23Rler2s1EHA.3576@TK2MSFTNGP12.phx.gbl...
> Indexing engine for DataTable in ADO.NET 1.x is not very optimized, thus
you
> facing this issue.
> It has been re-written in ADO.NET 2.0, and will do these operations much
> faster. I believe there is nothing much you can do about this. Storing
your
> data in multiple data tables will boost performance, but you will have to
> access this based on your requirements.
>
> --
> Regards,
>
> Deepak
> [I Code, therefore I am]
>
> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> news:uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl...
> > I'm using a DataTable to hold a selection of rows (100,000+) from a
large
> > database table (1,000,000+ rows). At times I want to remove rows that
> > aren't
> > used anymore from the DataTable to save memory. But my tests shows that
it
> > takes very long time to remove the rows. Running the code below on a
> > Pentium
> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
rows,
> > but 32s (seconds, that is!) to remove half of them.
> >
> > Can anybody tell me what I'm doing wrong or an alternative, faster way
to
> > do
> > this?
> >
> > // Create table with one int column
> > DataTable table = new DataTable();
> > table.Columns.Add(
> > new DataColumn(
> >  "Col1",
> >  typeof(int)
> > )
> > );
> >
> > // Add a number of rows to the table
> > int ticks = Environment.TickCount;
> > for (int i = 0; i < 100000; i++)
> > {
> > table.Rows.Add(new object[] {i});
> > }
> > int elapsed = Environment.TickCount - ticks;
> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
> > ms.");
> >
> > // Create a list of rows to remove (half of those in table)
> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > for (int i = 0; i < table.Rows.Count; i++)
> > {
> > if ((i % 2) == 0)
> >  rowsToRemove.Add(table.Rows[i]);
> > }
> >
> > // Remove the rows from the table
> > ticks = Environment.TickCount;
> > for (int i = 0; i < rowsToRemove.Count; i++)
> > {
> > table.Rows.Remove((DataRow)rowsToRemove[i]);
> > }
> > elapsed = Environment.TickCount - ticks;
> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed
+
> > "
> > ms.");
> >
> > Grateful for any help on this,
> >
> > Markus Hjarne
> >
> >
>
>
Author
1 Dec 2004 11:33 PM
Deepak
Hi Markus,

This is the source of my information on DataTable Indexing engine for
ADO.NET 2.0
http://msdn.microsoft.com/data/default.aspx?pull=/library/en-us/dnadonet/html/datasetenhance.asp

Regards,

Deepak
[I Code, therefore I am]


Show quoteHide quote
"Markus Hjärne" wrote:

> Thanks for yor reply,
>
> can you tell me what's your source of information when you say that the
> indexing engine has been re-written i ADO.NET 2.0?
>
> Regards,
>
> Markus
>
> "Deepak" <kapoordee***@gmail.com> skrev i meddelandet
> news:%23Rler2s1EHA.3576@TK2MSFTNGP12.phx.gbl...
> > Indexing engine for DataTable in ADO.NET 1.x is not very optimized, thus
> you
> > facing this issue.
> > It has been re-written in ADO.NET 2.0, and will do these operations much
> > faster. I believe there is nothing much you can do about this. Storing
> your
> > data in multiple data tables will boost performance, but you will have to
> > access this based on your requirements.
> >
> > --
> > Regards,
> >
> > Deepak
> > [I Code, therefore I am]
> >
> > "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > news:uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl...
> > > I'm using a DataTable to hold a selection of rows (100,000+) from a
> large
> > > database table (1,000,000+ rows). At times I want to remove rows that
> > > aren't
> > > used anymore from the DataTable to save memory. But my tests shows that
> it
> > > takes very long time to remove the rows. Running the code below on a
> > > Pentium
> > > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> rows,
> > > but 32s (seconds, that is!) to remove half of them.
> > >
> > > Can anybody tell me what I'm doing wrong or an alternative, faster way
> to
> > > do
> > > this?
> > >
> > > // Create table with one int column
> > > DataTable table = new DataTable();
> > > table.Columns.Add(
> > > new DataColumn(
> > >  "Col1",
> > >  typeof(int)
> > > )
> > > );
> > >
> > > // Add a number of rows to the table
> > > int ticks = Environment.TickCount;
> > > for (int i = 0; i < 100000; i++)
> > > {
> > > table.Rows.Add(new object[] {i});
> > > }
> > > int elapsed = Environment.TickCount - ticks;
> > > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
> > > ms.");
> > >
> > > // Create a list of rows to remove (half of those in table)
> > > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > > for (int i = 0; i < table.Rows.Count; i++)
> > > {
> > > if ((i % 2) == 0)
> > >  rowsToRemove.Add(table.Rows[i]);
> > > }
> > >
> > > // Remove the rows from the table
> > > ticks = Environment.TickCount;
> > > for (int i = 0; i < rowsToRemove.Count; i++)
> > > {
> > > table.Rows.Remove((DataRow)rowsToRemove[i]);
> > > }
> > > elapsed = Environment.TickCount - ticks;
> > > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed
> +
> > > "
> > > ms.");
> > >
> > > Grateful for any help on this,
> > >
> > > Markus Hjarne
> > >
> > >
> >
> >
>
>
>
Author
2 Dec 2004 7:17 AM
Markus Hjärne
Thanks for the reference,

but I couldn't see anything there about increased Remove performance. I
don't have any index on the DataTable in my test code, so I'm not sure it
will make any difference with the re-written indexing engine. And also,
another post in this thread mentions that Remove is still slow in .NET 2
beta.

Regards,

Markus


"Deepak" <Dee***@discussions.microsoft.com> skrev i meddelandet
news:86222232-F432-4501-A54C-01C8084DA580@microsoft.com...
> Hi Markus,
>
> This is the source of my information on DataTable Indexing engine for
> ADO.NET 2.0
>
>
http://msdn.microsoft.com/data/default.aspx?pull=/library/en-us/dnadonet/html/datasetenhance.asp
Show quoteHide quote
>
> Regards,
>
> Deepak
> [I Code, therefore I am]
>
>
> "Markus Hjärne" wrote:
>
> > Thanks for yor reply,
> >
> > can you tell me what's your source of information when you say that the
> > indexing engine has been re-written i ADO.NET 2.0?
> >
> > Regards,
> >
> > Markus
> >
> > "Deepak" <kapoordee***@gmail.com> skrev i meddelandet
> > news:%23Rler2s1EHA.3576@TK2MSFTNGP12.phx.gbl...
> > > Indexing engine for DataTable in ADO.NET 1.x is not very optimized,
thus
> > you
> > > facing this issue.
> > > It has been re-written in ADO.NET 2.0, and will do these operations
much
> > > faster. I believe there is nothing much you can do about this. Storing
> > your
> > > data in multiple data tables will boost performance, but you will have
to
> > > access this based on your requirements.
> > >
> > > --
> > > Regards,
> > >
> > > Deepak
> > > [I Code, therefore I am]
> > >
> > > "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > > news:uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl...
> > > > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > large
> > > > database table (1,000,000+ rows). At times I want to remove rows
that
> > > > aren't
> > > > used anymore from the DataTable to save memory. But my tests shows
that
> > it
> > > > takes very long time to remove the rows. Running the code below on a
> > > > Pentium
> > > > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > rows,
> > > > but 32s (seconds, that is!) to remove half of them.
> > > >
> > > > Can anybody tell me what I'm doing wrong or an alternative, faster
way
> > to
> > > > do
> > > > this?
> > > >
> > > > // Create table with one int column
> > > > DataTable table = new DataTable();
> > > > table.Columns.Add(
> > > > new DataColumn(
> > > >  "Col1",
> > > >  typeof(int)
> > > > )
> > > > );
> > > >
> > > > // Add a number of rows to the table
> > > > int ticks = Environment.TickCount;
> > > > for (int i = 0; i < 100000; i++)
> > > > {
> > > > table.Rows.Add(new object[] {i});
> > > > }
> > > > int elapsed = Environment.TickCount - ticks;
> > > > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed
+ "
> > > > ms.");
> > > >
> > > > // Create a list of rows to remove (half of those in table)
> > > > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > > > for (int i = 0; i < table.Rows.Count; i++)
> > > > {
> > > > if ((i % 2) == 0)
> > > >  rowsToRemove.Add(table.Rows[i]);
> > > > }
> > > >
> > > > // Remove the rows from the table
> > > > ticks = Environment.TickCount;
> > > > for (int i = 0; i < rowsToRemove.Count; i++)
> > > > {
> > > > table.Rows.Remove((DataRow)rowsToRemove[i]);
> > > > }
> > > > elapsed = Environment.TickCount - ticks;
> > > > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
elapsed
> > +
> > > > "
> > > > ms.");
> > > >
> > > > Grateful for any help on this,
> > > >
> > > > Markus Hjarne
> > > >
> > > >
> > >
> > >
> >
> >
> >
Author
2 Dec 2004 9:59 PM
Deepak
It is mentioned in the article. I will quote from the article itself


New Indexing Engine
The indexing engine for the DataTable has been completely rewritten in
ADO.NET 2.0 and scales much better for large datasets. This results in faster
basic inserts, updates, and deletes, and therefore faster Fill and Merge
operations

Regards,

Deepak
[I Code, therefore I am]


Show quoteHide quote
"Markus Hjärne" wrote:

> Thanks for the reference,
>
> but I couldn't see anything there about increased Remove performance. I
> don't have any index on the DataTable in my test code, so I'm not sure it
> will make any difference with the re-written indexing engine. And also,
> another post in this thread mentions that Remove is still slow in .NET 2
> beta.
>
> Regards,
>
> Markus
>
>
> "Deepak" <Dee***@discussions.microsoft.com> skrev i meddelandet
> news:86222232-F432-4501-A54C-01C8084DA580@microsoft.com...
> > Hi Markus,
> >
> > This is the source of my information on DataTable Indexing engine for
> > ADO.NET 2.0
> >
> >
> http://msdn.microsoft.com/data/default.aspx?pull=/library/en-us/dnadonet/html/datasetenhance.asp
> >
> > Regards,
> >
> > Deepak
> > [I Code, therefore I am]
> >
> >
> > "Markus Hjärne" wrote:
> >
> > > Thanks for yor reply,
> > >
> > > can you tell me what's your source of information when you say that the
> > > indexing engine has been re-written i ADO.NET 2.0?
> > >
> > > Regards,
> > >
> > > Markus
> > >
> > > "Deepak" <kapoordee***@gmail.com> skrev i meddelandet
> > > news:%23Rler2s1EHA.3576@TK2MSFTNGP12.phx.gbl...
> > > > Indexing engine for DataTable in ADO.NET 1.x is not very optimized,
> thus
> > > you
> > > > facing this issue.
> > > > It has been re-written in ADO.NET 2.0, and will do these operations
> much
> > > > faster. I believe there is nothing much you can do about this. Storing
> > > your
> > > > data in multiple data tables will boost performance, but you will have
> to
> > > > access this based on your requirements.
> > > >
> > > > --
> > > > Regards,
> > > >
> > > > Deepak
> > > > [I Code, therefore I am]
> > > >
> > > > "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > > > news:uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl...
> > > > > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > > large
> > > > > database table (1,000,000+ rows). At times I want to remove rows
> that
> > > > > aren't
> > > > > used anymore from the DataTable to save memory. But my tests shows
> that
> > > it
> > > > > takes very long time to remove the rows. Running the code below on a
> > > > > Pentium
> > > > > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > > rows,
> > > > > but 32s (seconds, that is!) to remove half of them.
> > > > >
> > > > > Can anybody tell me what I'm doing wrong or an alternative, faster
> way
> > > to
> > > > > do
> > > > > this?
> > > > >
> > > > > // Create table with one int column
> > > > > DataTable table = new DataTable();
> > > > > table.Columns.Add(
> > > > > new DataColumn(
> > > > >  "Col1",
> > > > >  typeof(int)
> > > > > )
> > > > > );
> > > > >
> > > > > // Add a number of rows to the table
> > > > > int ticks = Environment.TickCount;
> > > > > for (int i = 0; i < 100000; i++)
> > > > > {
> > > > > table.Rows.Add(new object[] {i});
> > > > > }
> > > > > int elapsed = Environment.TickCount - ticks;
> > > > > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed
> + "
> > > > > ms.");
> > > > >
> > > > > // Create a list of rows to remove (half of those in table)
> > > > > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > > > > for (int i = 0; i < table.Rows.Count; i++)
> > > > > {
> > > > > if ((i % 2) == 0)
> > > > >  rowsToRemove.Add(table.Rows[i]);
> > > > > }
> > > > >
> > > > > // Remove the rows from the table
> > > > > ticks = Environment.TickCount;
> > > > > for (int i = 0; i < rowsToRemove.Count; i++)
> > > > > {
> > > > > table.Rows.Remove((DataRow)rowsToRemove[i]);
> > > > > }
> > > > > elapsed = Environment.TickCount - ticks;
> > > > > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> elapsed
> > > +
> > > > > "
> > > > > ms.");
> > > > >
> > > > > Grateful for any help on this,
> > > > >
> > > > > Markus Hjarne
> > > > >
> > > > >
> > > >
> > > >
> > >
> > >
> > >
>
>
>
Author
3 Dec 2004 7:40 AM
Markus Hjärne
I'm sorry, but I still can't see anything about improved performance of
removal.

Regards,

Markus

Show quoteHide quote
"Deepak" <Dee***@discussions.microsoft.com> skrev i meddelandet
news:9B658604-E164-440A-8FEC-1361BBFCF2A7@microsoft.com...
> It is mentioned in the article. I will quote from the article itself
>
>
> New Indexing Engine
> The indexing engine for the DataTable has been completely rewritten in
> ADO.NET 2.0 and scales much better for large datasets. This results in
faster
> basic inserts, updates, and deletes, and therefore faster Fill and Merge
> operations
>
> Regards,
>
> Deepak
> [I Code, therefore I am]
>
>
> "Markus Hjärne" wrote:
>
> > Thanks for the reference,
> >
> > but I couldn't see anything there about increased Remove performance. I
> > don't have any index on the DataTable in my test code, so I'm not sure
it
> > will make any difference with the re-written indexing engine. And also,
> > another post in this thread mentions that Remove is still slow in .NET 2
> > beta.
> >
> > Regards,
> >
> > Markus
> >
> >
> > "Deepak" <Dee***@discussions.microsoft.com> skrev i meddelandet
> > news:86222232-F432-4501-A54C-01C8084DA580@microsoft.com...
> > > Hi Markus,
> > >
> > > This is the source of my information on DataTable Indexing engine for
> > > ADO.NET 2.0
> > >
> > >
> >
http://msdn.microsoft.com/data/default.aspx?pull=/library/en-us/dnadonet/html/datasetenhance.asp
Show quoteHide quote
> > >
> > > Regards,
> > >
> > > Deepak
> > > [I Code, therefore I am]
> > >
> > >
> > > "Markus Hjärne" wrote:
> > >
> > > > Thanks for yor reply,
> > > >
> > > > can you tell me what's your source of information when you say that
the
> > > > indexing engine has been re-written i ADO.NET 2.0?
> > > >
> > > > Regards,
> > > >
> > > > Markus
> > > >
> > > > "Deepak" <kapoordee***@gmail.com> skrev i meddelandet
> > > > news:%23Rler2s1EHA.3576@TK2MSFTNGP12.phx.gbl...
> > > > > Indexing engine for DataTable in ADO.NET 1.x is not very
optimized,
> > thus
> > > > you
> > > > > facing this issue.
> > > > > It has been re-written in ADO.NET 2.0, and will do these
operations
> > much
> > > > > faster. I believe there is nothing much you can do about this.
Storing
> > > > your
> > > > > data in multiple data tables will boost performance, but you will
have
> > to
> > > > > access this based on your requirements.
> > > > >
> > > > > --
> > > > > Regards,
> > > > >
> > > > > Deepak
> > > > > [I Code, therefore I am]
> > > > >
> > > > > "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > > > > news:uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl...
> > > > > > I'm using a DataTable to hold a selection of rows (100,000+)
from a
> > > > large
> > > > > > database table (1,000,000+ rows). At times I want to remove rows
> > that
> > > > > > aren't
> > > > > > used anymore from the DataTable to save memory. But my tests
shows
> > that
> > > > it
> > > > > > takes very long time to remove the rows. Running the code below
on a
> > > > > > Pentium
> > > > > > 2.4 Ghz under Windows XP reports that it takes 187ms to add
100,000
> > > > rows,
> > > > > > but 32s (seconds, that is!) to remove half of them.
> > > > > >
> > > > > > Can anybody tell me what I'm doing wrong or an alternative,
faster
> > way
> > > > to
> > > > > > do
> > > > > > this?
> > > > > >
> > > > > > // Create table with one int column
> > > > > > DataTable table = new DataTable();
> > > > > > table.Columns.Add(
> > > > > > new DataColumn(
> > > > > >  "Col1",
> > > > > >  typeof(int)
> > > > > > )
> > > > > > );
> > > > > >
> > > > > > // Add a number of rows to the table
> > > > > > int ticks = Environment.TickCount;
> > > > > > for (int i = 0; i < 100000; i++)
> > > > > > {
> > > > > > table.Rows.Add(new object[] {i});
> > > > > > }
> > > > > > int elapsed = Environment.TickCount - ticks;
> > > > > > MessageBox.Show("Added " + table.Rows.Count + " rows in " +
elapsed
> > + "
> > > > > > ms.");
> > > > > >
> > > > > > // Create a list of rows to remove (half of those in table)
> > > > > > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > > > > > for (int i = 0; i < table.Rows.Count; i++)
> > > > > > {
> > > > > > if ((i % 2) == 0)
> > > > > >  rowsToRemove.Add(table.Rows[i]);
> > > > > > }
> > > > > >
> > > > > > // Remove the rows from the table
> > > > > > ticks = Environment.TickCount;
> > > > > > for (int i = 0; i < rowsToRemove.Count; i++)
> > > > > > {
> > > > > > table.Rows.Remove((DataRow)rowsToRemove[i]);
> > > > > > }
> > > > > > elapsed = Environment.TickCount - ticks;
> > > > > > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> > elapsed
> > > > +
> > > > > > "
> > > > > > ms.");
> > > > > >
> > > > > > Grateful for any help on this,
> > > > > >
> > > > > > Markus Hjarne
> > > > > >
> > > > > >
> > > > >
> > > > >
> > > >
> > > >
> > > >
> >
> >
> >
Author
30 Nov 2004 1:32 PM
Martin
Datagrids are painfully slow with over one or two thousand records.
Instead, use a dataset to store and manipulate the data then add them
to a label.  This method is not as pretty or sortable, but faster.

Martin

Show quoteHide quote
"Markus Hjärne" <markus.hja***@landfocus.se> wrote in message news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> I'm using a DataTable to hold a selection of rows (100,000+) from a large
> database table (1,000,000+ rows). At times I want to remove rows that aren't
> used anymore from the DataTable to save memory. But my tests shows that it
> takes very long time to remove the rows. Running the code below on a Pentium
> 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000 rows,
> but 32s (seconds, that is!) to remove half of them.
>
> Can anybody tell me what I'm doing wrong or an alternative, faster way to do
> this?
>
> // Create table with one int column
> DataTable table = new DataTable();
> table.Columns.Add(
>  new DataColumn(
>   "Col1",
>   typeof(int)
>  )
> );
>
> // Add a number of rows to the table
> int ticks = Environment.TickCount;
> for (int i = 0; i < 100000; i++)
> {
>  table.Rows.Add(new object[] {i});
> }
> int elapsed = Environment.TickCount - ticks;
> MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
> ms.");
>
> // Create a list of rows to remove (half of those in table)
> ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> for (int i = 0; i < table.Rows.Count; i++)
> {
>  if ((i % 2) == 0)
>   rowsToRemove.Add(table.Rows[i]);
> }
>
> // Remove the rows from the table
> ticks = Environment.TickCount;
> for (int i = 0; i < rowsToRemove.Count; i++)
> {
>  table.Rows.Remove((DataRow)rowsToRemove[i]);
> }
> elapsed = Environment.TickCount - ticks;
> MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed + "
> ms.");
>
> Grateful for any help on this,
>
> Markus Hjarne
Author
30 Nov 2004 1:47 PM
Markus Hjärne
Thanks for your reply,

but I'm not using a DataGrid, only a DataTable, and everything except
removing rows from it is as fast as needed.

Regards,

Markus Hjarne

Show quoteHide quote
"Martin" skrev i meddelandet
news:7a32786b.0411300532.1f3531d1@posting.google.com...
> Datagrids are painfully slow with over one or two thousand records.
> Instead, use a dataset to store and manipulate the data then add them
> to a label.  This method is not as pretty or sortable, but faster.
>
> Martin
>
> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> > I'm using a DataTable to hold a selection of rows (100,000+) from a
large
> > database table (1,000,000+ rows). At times I want to remove rows that
aren't
> > used anymore from the DataTable to save memory. But my tests shows that
it
> > takes very long time to remove the rows. Running the code below on a
Pentium
> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
rows,
> > but 32s (seconds, that is!) to remove half of them.
> >
> > Can anybody tell me what I'm doing wrong or an alternative, faster way
to do
> > this?
> >
> > // Create table with one int column
> > DataTable table = new DataTable();
> > table.Columns.Add(
> >  new DataColumn(
> >   "Col1",
> >   typeof(int)
> >  )
> > );
> >
> > // Add a number of rows to the table
> > int ticks = Environment.TickCount;
> > for (int i = 0; i < 100000; i++)
> > {
> >  table.Rows.Add(new object[] {i});
> > }
> > int elapsed = Environment.TickCount - ticks;
> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
> > ms.");
> >
> > // Create a list of rows to remove (half of those in table)
> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > for (int i = 0; i < table.Rows.Count; i++)
> > {
> >  if ((i % 2) == 0)
> >   rowsToRemove.Add(table.Rows[i]);
> > }
> >
> > // Remove the rows from the table
> > ticks = Environment.TickCount;
> > for (int i = 0; i < rowsToRemove.Count; i++)
> > {
> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
> > }
> > elapsed = Environment.TickCount - ticks;
> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed
+ "
> > ms.");
> >
> > Grateful for any help on this,
> >
> > Markus Hjarne
Author
30 Nov 2004 2:15 PM
Miha Markic [MVP C#]
Try the process without any index on tha table in question.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com

Show quoteHide quote
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
news:%233etsMu1EHA.1300@TK2MSFTNGP14.phx.gbl...
> Thanks for your reply,
>
> but I'm not using a DataGrid, only a DataTable, and everything except
> removing rows from it is as fast as needed.
>
> Regards,
>
> Markus Hjarne
>
> "Martin" skrev i meddelandet
> news:7a32786b.0411300532.1f3531d1@posting.google.com...
>> Datagrids are painfully slow with over one or two thousand records.
>> Instead, use a dataset to store and manipulate the data then add them
>> to a label.  This method is not as pretty or sortable, but faster.
>>
>> Martin
>>
>> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
>> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> large
>> > database table (1,000,000+ rows). At times I want to remove rows that
> aren't
>> > used anymore from the DataTable to save memory. But my tests shows that
> it
>> > takes very long time to remove the rows. Running the code below on a
> Pentium
>> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> rows,
>> > but 32s (seconds, that is!) to remove half of them.
>> >
>> > Can anybody tell me what I'm doing wrong or an alternative, faster way
> to do
>> > this?
>> >
>> > // Create table with one int column
>> > DataTable table = new DataTable();
>> > table.Columns.Add(
>> >  new DataColumn(
>> >   "Col1",
>> >   typeof(int)
>> >  )
>> > );
>> >
>> > // Add a number of rows to the table
>> > int ticks = Environment.TickCount;
>> > for (int i = 0; i < 100000; i++)
>> > {
>> >  table.Rows.Add(new object[] {i});
>> > }
>> > int elapsed = Environment.TickCount - ticks;
>> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
>> > ms.");
>> >
>> > // Create a list of rows to remove (half of those in table)
>> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
>> > for (int i = 0; i < table.Rows.Count; i++)
>> > {
>> >  if ((i % 2) == 0)
>> >   rowsToRemove.Add(table.Rows[i]);
>> > }
>> >
>> > // Remove the rows from the table
>> > ticks = Environment.TickCount;
>> > for (int i = 0; i < rowsToRemove.Count; i++)
>> > {
>> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
>> > }
>> > elapsed = Environment.TickCount - ticks;
>> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed
> + "
>> > ms.");
>> >
>> > Grateful for any help on this,
>> >
>> > Markus Hjarne
>
>
Author
1 Dec 2004 7:04 AM
Markus Hjärne
I didn't think I had any index on the DataTable in my attached sample code -
no UniqueConstraint, no primary key, no ForeignKey constraint, nothing. Can
you please explain further what you mean.

Regards,

Markus

Show quoteHide quote
"Miha Markic [MVP C#]" <miha at rthand com> skrev i meddelandet
news:e$tUAcu1EHA.1564@TK2MSFTNGP09.phx.gbl...
> Try the process without any index on tha table in question.
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> SLODUG - Slovene Developer Users Group
> www.rthand.com
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> news:%233etsMu1EHA.1300@TK2MSFTNGP14.phx.gbl...
> > Thanks for your reply,
> >
> > but I'm not using a DataGrid, only a DataTable, and everything except
> > removing rows from it is as fast as needed.
> >
> > Regards,
> >
> > Markus Hjarne
> >
> > "Martin" skrev i meddelandet
> > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> >> Datagrids are painfully slow with over one or two thousand records.
> >> Instead, use a dataset to store and manipulate the data then add them
> >> to a label.  This method is not as pretty or sortable, but faster.
> >>
> >> Martin
> >>
> >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> >> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > large
> >> > database table (1,000,000+ rows). At times I want to remove rows that
> > aren't
> >> > used anymore from the DataTable to save memory. But my tests shows
that
> > it
> >> > takes very long time to remove the rows. Running the code below on a
> > Pentium
> >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > rows,
> >> > but 32s (seconds, that is!) to remove half of them.
> >> >
> >> > Can anybody tell me what I'm doing wrong or an alternative, faster
way
> > to do
> >> > this?
> >> >
> >> > // Create table with one int column
> >> > DataTable table = new DataTable();
> >> > table.Columns.Add(
> >> >  new DataColumn(
> >> >   "Col1",
> >> >   typeof(int)
> >> >  )
> >> > );
> >> >
> >> > // Add a number of rows to the table
> >> > int ticks = Environment.TickCount;
> >> > for (int i = 0; i < 100000; i++)
> >> > {
> >> >  table.Rows.Add(new object[] {i});
> >> > }
> >> > int elapsed = Environment.TickCount - ticks;
> >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed +
"
> >> > ms.");
> >> >
> >> > // Create a list of rows to remove (half of those in table)
> >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> >> > for (int i = 0; i < table.Rows.Count; i++)
> >> > {
> >> >  if ((i % 2) == 0)
> >> >   rowsToRemove.Add(table.Rows[i]);
> >> > }
> >> >
> >> > // Remove the rows from the table
> >> > ticks = Environment.TickCount;
> >> > for (int i = 0; i < rowsToRemove.Count; i++)
> >> > {
> >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
> >> > }
> >> > elapsed = Environment.TickCount - ticks;
> >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
elapsed
> > + "
> >> > ms.");
> >> >
> >> > Grateful for any help on this,
> >> >
> >> > Markus Hjarne
> >
> >
>
>
Author
1 Dec 2004 9:05 AM
Miha Markic [MVP C#]
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
news:eF6p6P31EHA.3000@TK2MSFTNGP15.phx.gbl...
>I didn't think I had any index on the DataTable in my attached sample
>code -
> no UniqueConstraint, no primary key, no ForeignKey constraint, nothing.
> Can
> you please explain further what you mean.

Ah, right, I overlooked the sample code :-)
You are right - it is slow.
It is a bit faster in .net 2 beta but still slow.
I guess the DataRowCollection isn't really optimised for Remove (I can
immagine that Remove is not a frequent operation afterall) method.
However, as others suggested, try retrieving less data at once.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
SLODUG - Slovene Developer Users Group
www.rthand.com
Show quoteHide quote
>
> Regards,
>
> Markus
>
> "Miha Markic [MVP C#]" <miha at rthand com> skrev i meddelandet
> news:e$tUAcu1EHA.1564@TK2MSFTNGP09.phx.gbl...
>> Try the process without any index on tha table in question.
>>
>> --
>> Miha Markic [MVP C#] - RightHand .NET consulting & development
>> SLODUG - Slovene Developer Users Group
>> www.rthand.com
>>
>> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
>> news:%233etsMu1EHA.1300@TK2MSFTNGP14.phx.gbl...
>> > Thanks for your reply,
>> >
>> > but I'm not using a DataGrid, only a DataTable, and everything except
>> > removing rows from it is as fast as needed.
>> >
>> > Regards,
>> >
>> > Markus Hjarne
>> >
>> > "Martin" skrev i meddelandet
>> > news:7a32786b.0411300532.1f3531d1@posting.google.com...
>> >> Datagrids are painfully slow with over one or two thousand records.
>> >> Instead, use a dataset to store and manipulate the data then add them
>> >> to a label.  This method is not as pretty or sortable, but faster.
>> >>
>> >> Martin
>> >>
>> >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
>> > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
>> >> > I'm using a DataTable to hold a selection of rows (100,000+) from a
>> > large
>> >> > database table (1,000,000+ rows). At times I want to remove rows
>> >> > that
>> > aren't
>> >> > used anymore from the DataTable to save memory. But my tests shows
> that
>> > it
>> >> > takes very long time to remove the rows. Running the code below on a
>> > Pentium
>> >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
>> > rows,
>> >> > but 32s (seconds, that is!) to remove half of them.
>> >> >
>> >> > Can anybody tell me what I'm doing wrong or an alternative, faster
> way
>> > to do
>> >> > this?
>> >> >
>> >> > // Create table with one int column
>> >> > DataTable table = new DataTable();
>> >> > table.Columns.Add(
>> >> >  new DataColumn(
>> >> >   "Col1",
>> >> >   typeof(int)
>> >> >  )
>> >> > );
>> >> >
>> >> > // Add a number of rows to the table
>> >> > int ticks = Environment.TickCount;
>> >> > for (int i = 0; i < 100000; i++)
>> >> > {
>> >> >  table.Rows.Add(new object[] {i});
>> >> > }
>> >> > int elapsed = Environment.TickCount - ticks;
>> >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed
>> >> > +
> "
>> >> > ms.");
>> >> >
>> >> > // Create a list of rows to remove (half of those in table)
>> >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
>> >> > for (int i = 0; i < table.Rows.Count; i++)
>> >> > {
>> >> >  if ((i % 2) == 0)
>> >> >   rowsToRemove.Add(table.Rows[i]);
>> >> > }
>> >> >
>> >> > // Remove the rows from the table
>> >> > ticks = Environment.TickCount;
>> >> > for (int i = 0; i < rowsToRemove.Count; i++)
>> >> > {
>> >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
>> >> > }
>> >> > elapsed = Environment.TickCount - ticks;
>> >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> elapsed
>> > + "
>> >> > ms.");
>> >> >
>> >> > Grateful for any help on this,
>> >> >
>> >> > Markus Hjarne
>> >
>> >
>>
>>
>
>
Author
1 Dec 2004 3:46 PM
Markus Hjärne
Then I think Microsoft should consider optimizing it for Remove, they got
the chance now when .NET 2.0 is still in beta.

They cannot reasonably figure out how all we developers will come to use the
..NET Framework, IMHO the only thing they can do is to really try to do their
best with every method of every class.

/Markus

Show quoteHide quote
"Miha Markic [MVP C#]" <miha at rthand com> skrev i meddelandet
news:%23kL1dT41EHA.2196@TK2MSFTNGP14.phx.gbl...
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> news:eF6p6P31EHA.3000@TK2MSFTNGP15.phx.gbl...
> >I didn't think I had any index on the DataTable in my attached sample
> >code -
> > no UniqueConstraint, no primary key, no ForeignKey constraint, nothing.
> > Can
> > you please explain further what you mean.
>
> Ah, right, I overlooked the sample code :-)
> You are right - it is slow.
> It is a bit faster in .net 2 beta but still slow.
> I guess the DataRowCollection isn't really optimised for Remove (I can
> immagine that Remove is not a frequent operation afterall) method.
> However, as others suggested, try retrieving less data at once.
>
> --
> Miha Markic [MVP C#] - RightHand .NET consulting & development
> SLODUG - Slovene Developer Users Group
> www.rthand.com
> >
> > Regards,
> >
> > Markus
> >
> > "Miha Markic [MVP C#]" <miha at rthand com> skrev i meddelandet
> > news:e$tUAcu1EHA.1564@TK2MSFTNGP09.phx.gbl...
> >> Try the process without any index on tha table in question.
> >>
> >> --
> >> Miha Markic [MVP C#] - RightHand .NET consulting & development
> >> SLODUG - Slovene Developer Users Group
> >> www.rthand.com
> >>
> >> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> >> news:%233etsMu1EHA.1300@TK2MSFTNGP14.phx.gbl...
> >> > Thanks for your reply,
> >> >
> >> > but I'm not using a DataGrid, only a DataTable, and everything except
> >> > removing rows from it is as fast as needed.
> >> >
> >> > Regards,
> >> >
> >> > Markus Hjarne
> >> >
> >> > "Martin" skrev i meddelandet
> >> > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> >> >> Datagrids are painfully slow with over one or two thousand records.
> >> >> Instead, use a dataset to store and manipulate the data then add
them
> >> >> to a label.  This method is not as pretty or sortable, but faster.
> >> >>
> >> >> Martin
> >> >>
> >> >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> >> > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> >> >> > I'm using a DataTable to hold a selection of rows (100,000+) from
a
> >> > large
> >> >> > database table (1,000,000+ rows). At times I want to remove rows
> >> >> > that
> >> > aren't
> >> >> > used anymore from the DataTable to save memory. But my tests shows
> > that
> >> > it
> >> >> > takes very long time to remove the rows. Running the code below on
a
> >> > Pentium
> >> >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add
100,000
> >> > rows,
> >> >> > but 32s (seconds, that is!) to remove half of them.
> >> >> >
> >> >> > Can anybody tell me what I'm doing wrong or an alternative, faster
> > way
> >> > to do
> >> >> > this?
> >> >> >
> >> >> > // Create table with one int column
> >> >> > DataTable table = new DataTable();
> >> >> > table.Columns.Add(
> >> >> >  new DataColumn(
> >> >> >   "Col1",
> >> >> >   typeof(int)
> >> >> >  )
> >> >> > );
> >> >> >
> >> >> > // Add a number of rows to the table
> >> >> > int ticks = Environment.TickCount;
> >> >> > for (int i = 0; i < 100000; i++)
> >> >> > {
> >> >> >  table.Rows.Add(new object[] {i});
> >> >> > }
> >> >> > int elapsed = Environment.TickCount - ticks;
> >> >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " +
elapsed
> >> >> > +
> > "
> >> >> > ms.");
> >> >> >
> >> >> > // Create a list of rows to remove (half of those in table)
> >> >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> >> >> > for (int i = 0; i < table.Rows.Count; i++)
> >> >> > {
> >> >> >  if ((i % 2) == 0)
> >> >> >   rowsToRemove.Add(table.Rows[i]);
> >> >> > }
> >> >> >
> >> >> > // Remove the rows from the table
> >> >> > ticks = Environment.TickCount;
> >> >> > for (int i = 0; i < rowsToRemove.Count; i++)
> >> >> > {
> >> >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
> >> >> > }
> >> >> > elapsed = Environment.TickCount - ticks;
> >> >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> > elapsed
> >> > + "
> >> >> > ms.");
> >> >> >
> >> >> > Grateful for any help on this,
> >> >> >
> >> >> > Markus Hjarne
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Author
30 Nov 2004 3:30 PM
Cor Ligthert
Markus,

I have as well seen that removing rows from a datatable is slow.

When I saw your message I thought is it not possible to clone the table, add
the datarows that should stayto the new one, remove the old and than rename
the new one.

It was just an idea, I did not try it.

Cor


Show quoteHide quote
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>

> Thanks for your reply,
>
> but I'm not using a DataGrid, only a DataTable, and everything except
> removing rows from it is as fast as needed.
>
> Regards,
>
> Markus Hjarne
>
> "Martin" skrev i meddelandet
> news:7a32786b.0411300532.1f3531d1@posting.google.com...
>> Datagrids are painfully slow with over one or two thousand records.
>> Instead, use a dataset to store and manipulate the data then add them
>> to a label.  This method is not as pretty or sortable, but faster.
>>
>> Martin
>>
>> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
>> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> large
>> > database table (1,000,000+ rows). At times I want to remove rows that
> aren't
>> > used anymore from the DataTable to save memory. But my tests shows that
> it
>> > takes very long time to remove the rows. Running the code below on a
> Pentium
>> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> rows,
>> > but 32s (seconds, that is!) to remove half of them.
>> >
>> > Can anybody tell me what I'm doing wrong or an alternative, faster way
> to do
>> > this?
>> >
>> > // Create table with one int column
>> > DataTable table = new DataTable();
>> > table.Columns.Add(
>> >  new DataColumn(
>> >   "Col1",
>> >   typeof(int)
>> >  )
>> > );
>> >
>> > // Add a number of rows to the table
>> > int ticks = Environment.TickCount;
>> > for (int i = 0; i < 100000; i++)
>> > {
>> >  table.Rows.Add(new object[] {i});
>> > }
>> > int elapsed = Environment.TickCount - ticks;
>> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed + "
>> > ms.");
>> >
>> > // Create a list of rows to remove (half of those in table)
>> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
>> > for (int i = 0; i < table.Rows.Count; i++)
>> > {
>> >  if ((i % 2) == 0)
>> >   rowsToRemove.Add(table.Rows[i]);
>> > }
>> >
>> > // Remove the rows from the table
>> > ticks = Environment.TickCount;
>> > for (int i = 0; i < rowsToRemove.Count; i++)
>> > {
>> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
>> > }
>> > elapsed = Environment.TickCount - ticks;
>> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " + elapsed
> + "
>> > ms.");
>> >
>> > Grateful for any help on this,
>> >
>> > Markus Hjarne
>
>
Author
30 Nov 2004 8:03 PM
Sahil Malik
First why is it slow?

.... it is slow because removing involves two main painful tasks that grow in
pain exponentially with rowcount - a) Checking to see if the row even exists
before removing it, for which it has to go thru 100,000 rows twice (one for
nulls and one for the actual object) .. I believe this is in
SyncIList.Remove. .. and b) Settling the rows as you remove it, because the
index will always go from 1,2,3,4, .. rather than 1,2,4 after you remove row
#3. This is unfortunately and logically so the built in arraylist behavior
which you cannot change - but hey it makes sense to have it the way it is.

Cor your suggestion will probably not work for two reasons -
a) DataTable.Clone will not do a deep clone. But that can be gotten around
using a BinaryFormatter/MemoryStream combination.
b) Even when you do have a perfectly deep copy assuming your server didn't
crap out for memory reasons - you still won't be able to add a row into the
previousdt, *unless* you remove it from the new data table (cloned) - and
there you take the penalty of removal anyway.

So we're stuck between a rock and a hardspot - well DataTables are not meant
to store such large number of rows - so my kneejerk reaction is to try and
minimize THAT MUCH data in one datatable - and if you have no other
alternative, look into implementing your own business object instead. Even
if this business object's purpose in life is to simply act as a bucket for
your datarows - creating a datatable when you need it will still probably
work better than what you have now. Not to mention, you can easily code up
the business object to be databindable etc. etc. (So you really don't need
the DataTable to do this dance).

If you really really wanted to be anal and absolutely must have to fix it -
then I believe you can use Reflection and tinker with the inner arraylist
and remove the exist checking portion and code the rest yourself. That's
about the only way I can think of :-/ .. but then again maybe some
concoction with DataView might help .. I don't know .. but before I take
that pain, I'd first try and minimize the amount of data in the datatable.

Another option would be to implement your very own datatable - which is
albeit more work - but it's really a generic business object that suits your
needs. A DataTable is not designed for 100,000 rows IMHO - what is the upper
limit - that is subjective to your use.

I know this isn't really a solution but still hope it helped anyway :-).

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
http://blogs.apress.com/authors.php?author=Sahil Malik





Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
news:#L4CcFv1EHA.208@TK2MSFTNGP12.phx.gbl...
> Markus,
>
> I have as well seen that removing rows from a datatable is slow.
>
> When I saw your message I thought is it not possible to clone the table,
add
> the datarows that should stayto the new one, remove the old and than
rename
> the new one.
>
> It was just an idea, I did not try it.
>
> Cor
>
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>
>
> > Thanks for your reply,
> >
> > but I'm not using a DataGrid, only a DataTable, and everything except
> > removing rows from it is as fast as needed.
> >
> > Regards,
> >
> > Markus Hjarne
> >
> > "Martin" skrev i meddelandet
> > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> >> Datagrids are painfully slow with over one or two thousand records.
> >> Instead, use a dataset to store and manipulate the data then add them
> >> to a label.  This method is not as pretty or sortable, but faster.
> >>
> >> Martin
> >>
> >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> >> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > large
> >> > database table (1,000,000+ rows). At times I want to remove rows that
> > aren't
> >> > used anymore from the DataTable to save memory. But my tests shows
that
> > it
> >> > takes very long time to remove the rows. Running the code below on a
> > Pentium
> >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > rows,
> >> > but 32s (seconds, that is!) to remove half of them.
> >> >
> >> > Can anybody tell me what I'm doing wrong or an alternative, faster
way
> > to do
> >> > this?
> >> >
> >> > // Create table with one int column
> >> > DataTable table = new DataTable();
> >> > table.Columns.Add(
> >> >  new DataColumn(
> >> >   "Col1",
> >> >   typeof(int)
> >> >  )
> >> > );
> >> >
> >> > // Add a number of rows to the table
> >> > int ticks = Environment.TickCount;
> >> > for (int i = 0; i < 100000; i++)
> >> > {
> >> >  table.Rows.Add(new object[] {i});
> >> > }
> >> > int elapsed = Environment.TickCount - ticks;
> >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed +
"
> >> > ms.");
> >> >
> >> > // Create a list of rows to remove (half of those in table)
> >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> >> > for (int i = 0; i < table.Rows.Count; i++)
> >> > {
> >> >  if ((i % 2) == 0)
> >> >   rowsToRemove.Add(table.Rows[i]);
> >> > }
> >> >
> >> > // Remove the rows from the table
> >> > ticks = Environment.TickCount;
> >> > for (int i = 0; i < rowsToRemove.Count; i++)
> >> > {
> >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
> >> > }
> >> > elapsed = Environment.TickCount - ticks;
> >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
elapsed
> > + "
> >> > ms.");
> >> >
> >> > Grateful for any help on this,
> >> >
> >> > Markus Hjarne
> >
> >
>
>
Author
1 Dec 2004 7:25 AM
Markus Hjärne
Thanks for your informative reply,

I can't remember reading anywhere how many rows a DataTable are 'meant' to
hold and if the test results I'm getting is not caused by anything odd I
have done, I actually think Microsoft has done a really lousy job in
implementing the Remove method. I think you can expect more from one of the
largest software companies in the world, especially since you as a
Windows-programmer almost always are at their mercy.

Regards,

Markus

Show quoteHide quote
"Sahil Malik" <contactmethrumyblog@nospam.com> skrev i meddelandet
news:O9QIyex1EHA.3840@tk2msftngp13.phx.gbl...
> First why is it slow?
>
> ... it is slow because removing involves two main painful tasks that grow
in
> pain exponentially with rowcount - a) Checking to see if the row even
exists
> before removing it, for which it has to go thru 100,000 rows twice (one
for
> nulls and one for the actual object) .. I believe this is in
> SyncIList.Remove. .. and b) Settling the rows as you remove it, because
the
> index will always go from 1,2,3,4, .. rather than 1,2,4 after you remove
row
> #3. This is unfortunately and logically so the built in arraylist behavior
> which you cannot change - but hey it makes sense to have it the way it is.
>
> Cor your suggestion will probably not work for two reasons -
> a) DataTable.Clone will not do a deep clone. But that can be gotten around
> using a BinaryFormatter/MemoryStream combination.
> b) Even when you do have a perfectly deep copy assuming your server didn't
> crap out for memory reasons - you still won't be able to add a row into
the
> previousdt, *unless* you remove it from the new data table (cloned) - and
> there you take the penalty of removal anyway.
>
> So we're stuck between a rock and a hardspot - well DataTables are not
meant
> to store such large number of rows - so my kneejerk reaction is to try and
> minimize THAT MUCH data in one datatable - and if you have no other
> alternative, look into implementing your own business object instead. Even
> if this business object's purpose in life is to simply act as a bucket for
> your datarows - creating a datatable when you need it will still probably
> work better than what you have now. Not to mention, you can easily code up
> the business object to be databindable etc. etc. (So you really don't need
> the DataTable to do this dance).
>
> If you really really wanted to be anal and absolutely must have to fix
it -
> then I believe you can use Reflection and tinker with the inner arraylist
> and remove the exist checking portion and code the rest yourself. That's
> about the only way I can think of :-/ .. but then again maybe some
> concoction with DataView might help .. I don't know .. but before I take
> that pain, I'd first try and minimize the amount of data in the datatable.
>
> Another option would be to implement your very own datatable - which is
> albeit more work - but it's really a generic business object that suits
your
> needs. A DataTable is not designed for 100,000 rows IMHO - what is the
upper
> limit - that is subjective to your use.
>
> I know this isn't really a solution but still hope it helped anyway :-).
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
> http://blogs.apress.com/authors.php?author=Sahil Malik
>
>
>
>
>
> "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
> news:#L4CcFv1EHA.208@TK2MSFTNGP12.phx.gbl...
> > Markus,
> >
> > I have as well seen that removing rows from a datatable is slow.
> >
> > When I saw your message I thought is it not possible to clone the table,
> add
> > the datarows that should stayto the new one, remove the old and than
> rename
> > the new one.
> >
> > It was just an idea, I did not try it.
> >
> > Cor
> >
> >
> > "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>
> >
> > > Thanks for your reply,
> > >
> > > but I'm not using a DataGrid, only a DataTable, and everything except
> > > removing rows from it is as fast as needed.
> > >
> > > Regards,
> > >
> > > Markus Hjarne
> > >
> > > "Martin" skrev i meddelandet
> > > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> > >> Datagrids are painfully slow with over one or two thousand records.
> > >> Instead, use a dataset to store and manipulate the data then add them
> > >> to a label. This method is not as pretty or sortable, but faster.
> > >>
> > >> Martin
> > >>
> > >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> > >> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > > large
> > >> > database table (1,000,000+ rows). At times I want to remove rows
that
> > > aren't
> > >> > used anymore from the DataTable to save memory. But my tests shows
> that
> > > it
> > >> > takes very long time to remove the rows. Running the code below on
a
> > > Pentium
> > >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > > rows,
> > >> > but 32s (seconds, that is!) to remove half of them.
> > >> >
> > >> > Can anybody tell me what I'm doing wrong or an alternative, faster
> way
> > > to do
> > >> > this?
> > >> >
> > >> > // Create table with one int column
> > >> > DataTable table = new DataTable();
> > >> > table.Columns.Add(
> > >> > new DataColumn(
> > >> > "Col1",
> > >> > typeof(int)
> > >> > )
> > >> > );
> > >> >
> > >> > // Add a number of rows to the table
> > >> > int ticks = Environment.TickCount;
> > >> > for (int i = 0; i < 100000; i++)
> > >> > {
> > >> > table.Rows.Add(new object[] {i});
> > >> > }
> > >> > int elapsed = Environment.TickCount - ticks;
> > >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed
+
> "
> > >> > ms.");
> > >> >
> > >> > // Create a list of rows to remove (half of those in table)
> > >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > >> > for (int i = 0; i < table.Rows.Count; i++)
> > >> > {
> > >> > if ((i % 2) == 0)
> > >> > rowsToRemove.Add(table.Rows[i]);
> > >> > }
> > >> >
> > >> > // Remove the rows from the table
> > >> > ticks = Environment.TickCount;
> > >> > for (int i = 0; i < rowsToRemove.Count; i++)
> > >> > {
> > >> > table.Rows.Remove((DataRow)rowsToRemove[i]);
> > >> > }
> > >> > elapsed = Environment.TickCount - ticks;
> > >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> elapsed
> > > + "
> > >> > ms.");
> > >> >
> > >> > Grateful for any help on this,
> > >> >
> > >> > Markus Hjarne
> > >
> > >
> >
> >
>
>
Author
1 Dec 2004 12:48 PM
Sahil Malik
Markus - if you had to write a datatable, how would you store the rows?
Microsoft uses an ArrayList.

I am curious to know because it is possible to write your own datatable,
albeit given the complexity, you'd have to reduce the feature set - BUT - if
nothing else, people from Microsoft are reading these replies and you just
might have a bright idea there.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik








Show quoteHide quote
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
news:Ofc6nb31EHA.3500@TK2MSFTNGP09.phx.gbl...
> Thanks for your informative reply,
>
> I can't remember reading anywhere how many rows a DataTable are 'meant' to
> hold and if the test results I'm getting is not caused by anything odd I
> have done, I actually think Microsoft has done a really lousy job in
> implementing the Remove method. I think you can expect more from one of
> the
> largest software companies in the world, especially since you as a
> Windows-programmer almost always are at their mercy.
>
> Regards,
>
> Markus
>
> "Sahil Malik" <contactmethrumyblog@nospam.com> skrev i meddelandet
> news:O9QIyex1EHA.3840@tk2msftngp13.phx.gbl...
>> First why is it slow?
>>
>> ... it is slow because removing involves two main painful tasks that grow
> in
>> pain exponentially with rowcount - a) Checking to see if the row even
> exists
>> before removing it, for which it has to go thru 100,000 rows twice (one
> for
>> nulls and one for the actual object) .. I believe this is in
>> SyncIList.Remove. .. and b) Settling the rows as you remove it, because
> the
>> index will always go from 1,2,3,4, .. rather than 1,2,4 after you remove
> row
>> #3. This is unfortunately and logically so the built in arraylist
>> behavior
>> which you cannot change - but hey it makes sense to have it the way it
>> is.
>>
>> Cor your suggestion will probably not work for two reasons -
>> a) DataTable.Clone will not do a deep clone. But that can be gotten
>> around
>> using a BinaryFormatter/MemoryStream combination.
>> b) Even when you do have a perfectly deep copy assuming your server
>> didn't
>> crap out for memory reasons - you still won't be able to add a row into
> the
>> previousdt, *unless* you remove it from the new data table (cloned) - and
>> there you take the penalty of removal anyway.
>>
>> So we're stuck between a rock and a hardspot - well DataTables are not
> meant
>> to store such large number of rows - so my kneejerk reaction is to try
>> and
>> minimize THAT MUCH data in one datatable - and if you have no other
>> alternative, look into implementing your own business object instead.
>> Even
>> if this business object's purpose in life is to simply act as a bucket
>> for
>> your datarows - creating a datatable when you need it will still probably
>> work better than what you have now. Not to mention, you can easily code
>> up
>> the business object to be databindable etc. etc. (So you really don't
>> need
>> the DataTable to do this dance).
>>
>> If you really really wanted to be anal and absolutely must have to fix
> it -
>> then I believe you can use Reflection and tinker with the inner arraylist
>> and remove the exist checking portion and code the rest yourself. That's
>> about the only way I can think of :-/ .. but then again maybe some
>> concoction with DataView might help .. I don't know .. but before I take
>> that pain, I'd first try and minimize the amount of data in the
>> datatable.
>>
>> Another option would be to implement your very own datatable - which is
>> albeit more work - but it's really a generic business object that suits
> your
>> needs. A DataTable is not designed for 100,000 rows IMHO - what is the
> upper
>> limit - that is subjective to your use.
>>
>> I know this isn't really a solution but still hope it helped anyway :-).
>>
>> - Sahil Malik
>> http://dotnetjunkies.com/weblog/sahilmalik
>> http://blogs.apress.com/authors.php?author=Sahil Malik
>>
>>
>>
>>
>>
>> "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
>> news:#L4CcFv1EHA.208@TK2MSFTNGP12.phx.gbl...
>> > Markus,
>> >
>> > I have as well seen that removing rows from a datatable is slow.
>> >
>> > When I saw your message I thought is it not possible to clone the
>> > table,
>> add
>> > the datarows that should stayto the new one, remove the old and than
>> rename
>> > the new one.
>> >
>> > It was just an idea, I did not try it.
>> >
>> > Cor
>> >
>> >
>> > "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>
>> >
>> > > Thanks for your reply,
>> > >
>> > > but I'm not using a DataGrid, only a DataTable, and everything except
>> > > removing rows from it is as fast as needed.
>> > >
>> > > Regards,
>> > >
>> > > Markus Hjarne
>> > >
>> > > "Martin" skrev i meddelandet
>> > > news:7a32786b.0411300532.1f3531d1@posting.google.com...
>> > >> Datagrids are painfully slow with over one or two thousand records.
>> > >> Instead, use a dataset to store and manipulate the data then add
>> > >> them
>> > >> to a label.  This method is not as pretty or sortable, but faster.
>> > >>
>> > >> Martin
>> > >>
>> > >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
>> > > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
>> > >> > I'm using a DataTable to hold a selection of rows (100,000+) from
>> > >> > a
>> > > large
>> > >> > database table (1,000,000+ rows). At times I want to remove rows
> that
>> > > aren't
>> > >> > used anymore from the DataTable to save memory. But my tests shows
>> that
>> > > it
>> > >> > takes very long time to remove the rows. Running the code below on
> a
>> > > Pentium
>> > >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add
>> > >> > 100,000
>> > > rows,
>> > >> > but 32s (seconds, that is!) to remove half of them.
>> > >> >
>> > >> > Can anybody tell me what I'm doing wrong or an alternative, faster
>> way
>> > > to do
>> > >> > this?
>> > >> >
>> > >> > // Create table with one int column
>> > >> > DataTable table = new DataTable();
>> > >> > table.Columns.Add(
>> > >> >  new DataColumn(
>> > >> >   "Col1",
>> > >> >   typeof(int)
>> > >> >  )
>> > >> > );
>> > >> >
>> > >> > // Add a number of rows to the table
>> > >> > int ticks = Environment.TickCount;
>> > >> > for (int i = 0; i < 100000; i++)
>> > >> > {
>> > >> >  table.Rows.Add(new object[] {i});
>> > >> > }
>> > >> > int elapsed = Environment.TickCount - ticks;
>> > >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " +
>> > >> > elapsed
> +
>> "
>> > >> > ms.");
>> > >> >
>> > >> > // Create a list of rows to remove (half of those in table)
>> > >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
>> > >> > for (int i = 0; i < table.Rows.Count; i++)
>> > >> > {
>> > >> >  if ((i % 2) == 0)
>> > >> >   rowsToRemove.Add(table.Rows[i]);
>> > >> > }
>> > >> >
>> > >> > // Remove the rows from the table
>> > >> > ticks = Environment.TickCount;
>> > >> > for (int i = 0; i < rowsToRemove.Count; i++)
>> > >> > {
>> > >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
>> > >> > }
>> > >> > elapsed = Environment.TickCount - ticks;
>> > >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
>> elapsed
>> > > + "
>> > >> > ms.");
>> > >> >
>> > >> > Grateful for any help on this,
>> > >> >
>> > >> > Markus Hjarne
>> > >
>> > >
>> >
>> >
>>
>>
>
>
Author
1 Dec 2004 3:33 PM
Markus Hjärne
I did some further tests with Remove() on ArrayList, and it's also very slow
when using the Remove method. But by first creating a Hashtable with all the
elements in the ArrayList as keys and their indices in the original
ArrayList as values, then using the Hashtable to create another ArrayList
with the indices of all the elements to remove, sorting it and then using
RemoveAt() on the original ArrayList, I managed to get resonable
performance.

The sort was necessary to ensure that the element with the highest index was
removed first, then the next highest and so on, since RemoveAt() changes the
indices of all elements with higher index. This algorithm also requires that
each element in the original ArrayList is unique.

So, why not use this technique for the DataTable? Simple because
DataRowCollection.RemoveAt() is as slow as DataRowCollection.Remove()!

But since every DataRow in a DataTable is a unique object, Microsoft could
use this technique in the DataTable class and add a
BeginRemove()/EndRemove() pair of methods (like
BeginLoadData()/EndLoadData()).

/Markus


Show quoteHide quote
"Sahil Malik" <contactmethrumyblog@nospam.com> skrev i meddelandet
news:uLMRXQ61EHA.132@tk2msftngp13.phx.gbl...
> Markus - if you had to write a datatable, how would you store the rows?
> Microsoft uses an ArrayList.
>
> I am curious to know because it is possible to write your own datatable,
> albeit given the complexity, you'd have to reduce the feature set - BUT -
if
> nothing else, people from Microsoft are reading these replies and you just
> might have a bright idea there.
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
>
>
>
>
>
>
>
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> news:Ofc6nb31EHA.3500@TK2MSFTNGP09.phx.gbl...
> > Thanks for your informative reply,
> >
> > I can't remember reading anywhere how many rows a DataTable are 'meant'
to
> > hold and if the test results I'm getting is not caused by anything odd I
> > have done, I actually think Microsoft has done a really lousy job in
> > implementing the Remove method. I think you can expect more from one of
> > the
> > largest software companies in the world, especially since you as a
> > Windows-programmer almost always are at their mercy.
> >
> > Regards,
> >
> > Markus
> >
> > "Sahil Malik" <contactmethrumyblog@nospam.com> skrev i meddelandet
> > news:O9QIyex1EHA.3840@tk2msftngp13.phx.gbl...
> >> First why is it slow?
> >>
> >> ... it is slow because removing involves two main painful tasks that
grow
> > in
> >> pain exponentially with rowcount - a) Checking to see if the row even
> > exists
> >> before removing it, for which it has to go thru 100,000 rows twice (one
> > for
> >> nulls and one for the actual object) .. I believe this is in
> >> SyncIList.Remove. .. and b) Settling the rows as you remove it, because
> > the
> >> index will always go from 1,2,3,4, .. rather than 1,2,4 after you
remove
> > row
> >> #3. This is unfortunately and logically so the built in arraylist
> >> behavior
> >> which you cannot change - but hey it makes sense to have it the way it
> >> is.
> >>
> >> Cor your suggestion will probably not work for two reasons -
> >> a) DataTable.Clone will not do a deep clone. But that can be gotten
> >> around
> >> using a BinaryFormatter/MemoryStream combination.
> >> b) Even when you do have a perfectly deep copy assuming your server
> >> didn't
> >> crap out for memory reasons - you still won't be able to add a row into
> > the
> >> previousdt, *unless* you remove it from the new data table (cloned) -
and
> >> there you take the penalty of removal anyway.
> >>
> >> So we're stuck between a rock and a hardspot - well DataTables are not
> > meant
> >> to store such large number of rows - so my kneejerk reaction is to try
> >> and
> >> minimize THAT MUCH data in one datatable - and if you have no other
> >> alternative, look into implementing your own business object instead.
> >> Even
> >> if this business object's purpose in life is to simply act as a bucket
> >> for
> >> your datarows - creating a datatable when you need it will still
probably
> >> work better than what you have now. Not to mention, you can easily code
> >> up
> >> the business object to be databindable etc. etc. (So you really don't
> >> need
> >> the DataTable to do this dance).
> >>
> >> If you really really wanted to be anal and absolutely must have to fix
> > it -
> >> then I believe you can use Reflection and tinker with the inner
arraylist
> >> and remove the exist checking portion and code the rest yourself.
That's
> >> about the only way I can think of :-/ .. but then again maybe some
> >> concoction with DataView might help .. I don't know .. but before I
take
> >> that pain, I'd first try and minimize the amount of data in the
> >> datatable.
> >>
> >> Another option would be to implement your very own datatable - which is
> >> albeit more work - but it's really a generic business object that suits
> > your
> >> needs. A DataTable is not designed for 100,000 rows IMHO - what is the
> > upper
> >> limit - that is subjective to your use.
> >>
> >> I know this isn't really a solution but still hope it helped anyway
:-).
> >>
> >> - Sahil Malik
> >> http://dotnetjunkies.com/weblog/sahilmalik
> >> http://blogs.apress.com/authors.php?author=Sahil Malik
> >>
> >>
> >>
> >>
> >>
> >> "Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
> >> news:#L4CcFv1EHA.208@TK2MSFTNGP12.phx.gbl...
> >> > Markus,
> >> >
> >> > I have as well seen that removing rows from a datatable is slow.
> >> >
> >> > When I saw your message I thought is it not possible to clone the
> >> > table,
> >> add
> >> > the datarows that should stayto the new one, remove the old and than
> >> rename
> >> > the new one.
> >> >
> >> > It was just an idea, I did not try it.
> >> >
> >> > Cor
> >> >
> >> >
> >> > "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>
> >> >
> >> > > Thanks for your reply,
> >> > >
> >> > > but I'm not using a DataGrid, only a DataTable, and everything
except
> >> > > removing rows from it is as fast as needed.
> >> > >
> >> > > Regards,
> >> > >
> >> > > Markus Hjarne
> >> > >
> >> > > "Martin" skrev i meddelandet
> >> > > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> >> > >> Datagrids are painfully slow with over one or two thousand
records.
> >> > >> Instead, use a dataset to store and manipulate the data then add
> >> > >> them
> >> > >> to a label. This method is not as pretty or sortable, but faster.
> >> > >>
> >> > >> Martin
> >> > >>
> >> > >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> >> > > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> >> > >> > I'm using a DataTable to hold a selection of rows (100,000+)
from
> >> > >> > a
> >> > > large
> >> > >> > database table (1,000,000+ rows). At times I want to remove rows
> > that
> >> > > aren't
> >> > >> > used anymore from the DataTable to save memory. But my tests
shows
> >> that
> >> > > it
> >> > >> > takes very long time to remove the rows. Running the code below
on
> > a
> >> > > Pentium
> >> > >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add
> >> > >> > 100,000
> >> > > rows,
> >> > >> > but 32s (seconds, that is!) to remove half of them.
> >> > >> >
> >> > >> > Can anybody tell me what I'm doing wrong or an alternative,
faster
> >> way
> >> > > to do
> >> > >> > this?
> >> > >> >
> >> > >> > // Create table with one int column
> >> > >> > DataTable table = new DataTable();
> >> > >> > table.Columns.Add(
> >> > >> > new DataColumn(
> >> > >> > "Col1",
> >> > >> > typeof(int)
> >> > >> > )
> >> > >> > );
> >> > >> >
> >> > >> > // Add a number of rows to the table
> >> > >> > int ticks = Environment.TickCount;
> >> > >> > for (int i = 0; i < 100000; i++)
> >> > >> > {
> >> > >> > table.Rows.Add(new object[] {i});
> >> > >> > }
> >> > >> > int elapsed = Environment.TickCount - ticks;
> >> > >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " +
> >> > >> > elapsed
> > +
> >> "
> >> > >> > ms.");
> >> > >> >
> >> > >> > // Create a list of rows to remove (half of those in table)
> >> > >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> >> > >> > for (int i = 0; i < table.Rows.Count; i++)
> >> > >> > {
> >> > >> > if ((i % 2) == 0)
> >> > >> > rowsToRemove.Add(table.Rows[i]);
> >> > >> > }
> >> > >> >
> >> > >> > // Remove the rows from the table
> >> > >> > ticks = Environment.TickCount;
> >> > >> > for (int i = 0; i < rowsToRemove.Count; i++)
> >> > >> > {
> >> > >> > table.Rows.Remove((DataRow)rowsToRemove[i]);
> >> > >> > }
> >> > >> > elapsed = Environment.TickCount - ticks;
> >> > >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> >> elapsed
> >> > > + "
> >> > >> > ms.");
> >> > >> >
> >> > >> > Grateful for any help on this,
> >> > >> >
> >> > >> > Markus Hjarne
> >> > >
> >> > >
> >> >
> >> >
> >>
> >>
> >
> >
>
>
Author
1 Dec 2004 11:29 AM
Cor Ligthert
>
> Cor your suggestion will probably not work for two reasons -
> a) DataTable.Clone will not do a deep clone. But that can be gotten around
> using a BinaryFormatter/MemoryStream combination.

There should not be made a deep copy. The schema should be copied and the
rows that stayed inserted to that new table and that is exactly what the
datatable clone does.

http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassclonetopic.asp

Where you got the idea that I suggested a deep copy, that gives no result at
all.

When is told creating the table cost 187Ms and removing the rows 32Sec than
why not creating it partially new with the rows that stay?

However it was only an idea.

Cor
Author
1 Dec 2004 12:44 PM
Sahil Malik
I thought you said DataTable.Clone .. sorry for the misunderstanding if you
didn't.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik


Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> wrote in message
news:%234yyWj51EHA.2156@TK2MSFTNGP10.phx.gbl...
> >
>> Cor your suggestion will probably not work for two reasons -
>> a) DataTable.Clone will not do a deep clone. But that can be gotten
>> around
>> using a BinaryFormatter/MemoryStream combination.
>
> There should not be made a deep copy. The schema should be copied and the
> rows that stayed inserted to that new table and that is exactly what the
> datatable clone does.
>
> http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cpref/html/frlrfsystemdatadatatableclassclonetopic.asp
>
> Where you got the idea that I suggested a deep copy, that gives no result
> at all.
>
> When is told creating the table cost 187Ms and removing the rows 32Sec
> than why not creating it partially new with the rows that stay?
>
> However it was only an idea.
>
> Cor
>
>
Author
1 Dec 2004 12:52 PM
Cor Ligthert
>I thought you said DataTable.Clone .. sorry for the misunderstanding if you
>didn't.

I said, to get the schema not to make a deep copy .

Cor
Author
1 Dec 2004 7:11 AM
Markus Hjärne
Thanks for your suggestion,

I have actually thought about something simliar myself, but the problem is
that in my real application there aren't just one DataTable, there are quite
a few and there are also data relations between them and on top of that
there are also custom business objects referencing the DataRows...
So I dropped the idea pretty soon, but seeing how slow Remove is I'm quite
sure following your idea will yield better performance than using Remove.
And if I can't find any better idea, I might have to follow that dark road
in the end.

Thanks again,

Markus


Show quoteHide quote
"Cor Ligthert" <notmyfirstn***@planet.nl> skrev i meddelandet
news:%23L4CcFv1EHA.208@TK2MSFTNGP12.phx.gbl...
> Markus,
>
> I have as well seen that removing rows from a datatable is slow.
>
> When I saw your message I thought is it not possible to clone the table,
add
> the datarows that should stayto the new one, remove the old and than
rename
> the new one.
>
> It was just an idea, I did not try it.
>
> Cor
>
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>
>
> > Thanks for your reply,
> >
> > but I'm not using a DataGrid, only a DataTable, and everything except
> > removing rows from it is as fast as needed.
> >
> > Regards,
> >
> > Markus Hjarne
> >
> > "Martin" skrev i meddelandet
> > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> >> Datagrids are painfully slow with over one or two thousand records.
> >> Instead, use a dataset to store and manipulate the data then add them
> >> to a label.  This method is not as pretty or sortable, but faster.
> >>
> >> Martin
> >>
> >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> >> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > large
> >> > database table (1,000,000+ rows). At times I want to remove rows that
> > aren't
> >> > used anymore from the DataTable to save memory. But my tests shows
that
> > it
> >> > takes very long time to remove the rows. Running the code below on a
> > Pentium
> >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > rows,
> >> > but 32s (seconds, that is!) to remove half of them.
> >> >
> >> > Can anybody tell me what I'm doing wrong or an alternative, faster
way
> > to do
> >> > this?
> >> >
> >> > // Create table with one int column
> >> > DataTable table = new DataTable();
> >> > table.Columns.Add(
> >> >  new DataColumn(
> >> >   "Col1",
> >> >   typeof(int)
> >> >  )
> >> > );
> >> >
> >> > // Add a number of rows to the table
> >> > int ticks = Environment.TickCount;
> >> > for (int i = 0; i < 100000; i++)
> >> > {
> >> >  table.Rows.Add(new object[] {i});
> >> > }
> >> > int elapsed = Environment.TickCount - ticks;
> >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed +
"
> >> > ms.");
> >> >
> >> > // Create a list of rows to remove (half of those in table)
> >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> >> > for (int i = 0; i < table.Rows.Count; i++)
> >> > {
> >> >  if ((i % 2) == 0)
> >> >   rowsToRemove.Add(table.Rows[i]);
> >> > }
> >> >
> >> > // Remove the rows from the table
> >> > ticks = Environment.TickCount;
> >> > for (int i = 0; i < rowsToRemove.Count; i++)
> >> > {
> >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
> >> > }
> >> > elapsed = Environment.TickCount - ticks;
> >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
elapsed
> > + "
> >> > ms.");
> >> >
> >> > Grateful for any help on this,
> >> >
> >> > Markus Hjarne
> >
> >
>
>
Author
2 Dec 2004 2:13 AM
Sahil Malik
Markus,

Creating business objects or using System.Data.* - that is a problem area -
which is why the entire Science of ORM exists. Anyway, I read your other
suggestion (about hashtable), and this being a MS news group, more than
certainly some microsoft guy will read that.

Good going.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik






Show quoteHide quote
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
news:#gVPJU31EHA.2192@TK2MSFTNGP14.phx.gbl...
> Thanks for your suggestion,
>
> I have actually thought about something simliar myself, but the problem is
> that in my real application there aren't just one DataTable, there are
quite
> a few and there are also data relations between them and on top of that
> there are also custom business objects referencing the DataRows...
> So I dropped the idea pretty soon, but seeing how slow Remove is I'm quite
> sure following your idea will yield better performance than using Remove.
> And if I can't find any better idea, I might have to follow that dark road
> in the end.
>
> Thanks again,
>
> Markus
>
>
> "Cor Ligthert" <notmyfirstn***@planet.nl> skrev i meddelandet
> news:%23L4CcFv1EHA.208@TK2MSFTNGP12.phx.gbl...
> > Markus,
> >
> > I have as well seen that removing rows from a datatable is slow.
> >
> > When I saw your message I thought is it not possible to clone the table,
> add
> > the datarows that should stayto the new one, remove the old and than
> rename
> > the new one.
> >
> > It was just an idea, I did not try it.
> >
> > Cor
> >
> >
> > "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se>
> >
> > > Thanks for your reply,
> > >
> > > but I'm not using a DataGrid, only a DataTable, and everything except
> > > removing rows from it is as fast as needed.
> > >
> > > Regards,
> > >
> > > Markus Hjarne
> > >
> > > "Martin" skrev i meddelandet
> > > news:7a32786b.0411300532.1f3531d1@posting.google.com...
> > >> Datagrids are painfully slow with over one or two thousand records.
> > >> Instead, use a dataset to store and manipulate the data then add them
> > >> to a label.  This method is not as pretty or sortable, but faster.
> > >>
> > >> Martin
> > >>
> > >> "Markus Hjärne" <markus.hja***@landfocus.se> wrote in message
> > > news:<uNU5uZr1EHA.1408@TK2MSFTNGP10.phx.gbl>...
> > >> > I'm using a DataTable to hold a selection of rows (100,000+) from a
> > > large
> > >> > database table (1,000,000+ rows). At times I want to remove rows
that
> > > aren't
> > >> > used anymore from the DataTable to save memory. But my tests shows
> that
> > > it
> > >> > takes very long time to remove the rows. Running the code below on
a
> > > Pentium
> > >> > 2.4 Ghz under Windows XP reports that it takes 187ms to add 100,000
> > > rows,
> > >> > but 32s (seconds, that is!) to remove half of them.
> > >> >
> > >> > Can anybody tell me what I'm doing wrong or an alternative, faster
> way
> > > to do
> > >> > this?
> > >> >
> > >> > // Create table with one int column
> > >> > DataTable table = new DataTable();
> > >> > table.Columns.Add(
> > >> >  new DataColumn(
> > >> >   "Col1",
> > >> >   typeof(int)
> > >> >  )
> > >> > );
> > >> >
> > >> > // Add a number of rows to the table
> > >> > int ticks = Environment.TickCount;
> > >> > for (int i = 0; i < 100000; i++)
> > >> > {
> > >> >  table.Rows.Add(new object[] {i});
> > >> > }
> > >> > int elapsed = Environment.TickCount - ticks;
> > >> > MessageBox.Show("Added " + table.Rows.Count + " rows in " + elapsed
+
> "
> > >> > ms.");
> > >> >
> > >> > // Create a list of rows to remove (half of those in table)
> > >> > ArrayList rowsToRemove = new ArrayList(table.Rows.Count/2);
> > >> > for (int i = 0; i < table.Rows.Count; i++)
> > >> > {
> > >> >  if ((i % 2) == 0)
> > >> >   rowsToRemove.Add(table.Rows[i]);
> > >> > }
> > >> >
> > >> > // Remove the rows from the table
> > >> > ticks = Environment.TickCount;
> > >> > for (int i = 0; i < rowsToRemove.Count; i++)
> > >> > {
> > >> >  table.Rows.Remove((DataRow)rowsToRemove[i]);
> > >> > }
> > >> > elapsed = Environment.TickCount - ticks;
> > >> > MessageBox.Show("Removed " + rowsToRemove.Count + " rows in " +
> elapsed
> > > + "
> > >> > ms.");
> > >> >
> > >> > Grateful for any help on this,
> > >> >
> > >> > Markus Hjarne
> > >
> > >
> >
> >
>
>
Author
4 Dec 2004 12:11 PM
Nayana
hai everybody,

I created a code to retrieve mails from from using vb.net.
Initially imported outlook.mailitem ,by adding microsoft outlook reference
in add refernces.
All the properties except "SenderEmailAddress" is being shown in the
properties list.
Can anyone help me out.
Nayana.
Author
4 Dec 2004 12:11 PM
Nayana
hai everybody,

I created a code to retrieve mails from from using vb.net.
Initially imported outlook.mailitem ,by adding microsoft outlook reference
in add refernces.
All the properties except "SenderEmailAddress" is being shown in the
properties list.
Can anyone help me out.
Nayana.
Author
4 Dec 2004 12:11 PM
Nayana
hai everybody,

I created a code to retrieve mails from from using vb.net.
Initially imported outlook.mailitem ,by adding microsoft outlook reference
in add refernces.
All the properties except "SenderEmailAddress" is being shown in the
properties list.
Can anyone help me out.
Nayana.
Author
4 Dec 2004 12:11 PM
Nayana
hai everybody,

I created a code to retrieve mails from from using vb.net.
Initially imported outlook.mailitem ,by adding microsoft outlook reference
in add refernces.
All the properties except "SenderEmailAddress" is being shown in the
properties list.
Can anyone help me out.
Nayana.
Author
4 Dec 2004 12:11 PM
Nayana
hai everybody,

I created a code to retrieve mails from from using vb.net.
Initially imported outlook.mailitem ,by adding microsoft outlook reference
in add refernces.
All the properties except "SenderEmailAddress" is being shown in the
properties list.
Can anyone help me out.
Nayana.
Author
4 Dec 2004 6:32 PM
Imac_Man
He Excuse my Exglish please,

and is necesary that you use outlook reference for send emails, beacause you
can use Echange directly.


Show quoteHide quote
"Nayana" <naina***@yahoomail.com> escribió en el mensaje
news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
4 Dec 2004 6:32 PM
Imac_Man
He Excuse my Exglish please,

and is necesary that you use outlook reference for send emails, beacause you
can use Echange directly.


Show quoteHide quote
"Nayana" <naina***@yahoomail.com> escribió en el mensaje
news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
4 Dec 2004 6:32 PM
Imac_Man
He Excuse my Exglish please,

and is necesary that you use outlook reference for send emails, beacause you
can use Echange directly.


Show quoteHide quote
"Nayana" <naina***@yahoomail.com> escribió en el mensaje
news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
4 Dec 2004 6:32 PM
Imac_Man
He Excuse my Exglish please,

and is necesary that you use outlook reference for send emails, beacause you
can use Echange directly.


Show quoteHide quote
"Nayana" <naina***@yahoomail.com> escribió en el mensaje
news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
4 Dec 2004 6:32 PM
Imac_Man
He Excuse my Exglish please,

and is necesary that you use outlook reference for send emails, beacause you
can use Echange directly.


Show quoteHide quote
"Nayana" <naina***@yahoomail.com> escribió en el mensaje
news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
6 Dec 2004 10:55 AM
Isabelle Prawitz
Hello !
SenderEmailAddress is a property of Outlook 2003.
If you don't see it, your reference isn't Outlook 2003 (Outlook 11.0).

Bye
Isa

Show quoteHide quote
"Nayana" <naina***@yahoomail.com> a écrit dans le message de news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
6 Dec 2004 10:55 AM
Isabelle Prawitz
Hello !
SenderEmailAddress is a property of Outlook 2003.
If you don't see it, your reference isn't Outlook 2003 (Outlook 11.0).

Bye
Isa

Show quoteHide quote
"Nayana" <naina***@yahoomail.com> a écrit dans le message de news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
6 Dec 2004 10:55 AM
Isabelle Prawitz
Hello !
SenderEmailAddress is a property of Outlook 2003.
If you don't see it, your reference isn't Outlook 2003 (Outlook 11.0).

Bye
Isa

Show quoteHide quote
"Nayana" <naina***@yahoomail.com> a écrit dans le message de news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
6 Dec 2004 10:55 AM
Isabelle Prawitz
Hello !
SenderEmailAddress is a property of Outlook 2003.
If you don't see it, your reference isn't Outlook 2003 (Outlook 11.0).

Bye
Isa

Show quoteHide quote
"Nayana" <naina***@yahoomail.com> a écrit dans le message de news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
6 Dec 2004 10:55 AM
Isabelle Prawitz
Hello !
SenderEmailAddress is a property of Outlook 2003.
If you don't see it, your reference isn't Outlook 2003 (Outlook 11.0).

Bye
Isa

Show quoteHide quote
"Nayana" <naina***@yahoomail.com> a écrit dans le message de news:uSI55pf2EHA.1152@TK2MSFTNGP14.phx.gbl...
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
Author
6 Dec 2004 5:03 PM
MyriamB
Dim email As New Mail.MailMessage()
        Dim pj As New Mail.MailAttachment(Chemin_Dossier_Lettre() &
"Reponse_Allo_Mairie_" & tableau(0, 5) & ".doc")
                email.To = email_Secretariat()
                email.From = "Technicien_Allo_Mairie"
                email.Body = "Le Technicien vient de cloturer une
intervention. Vous trouverez ci-joint la lettre qui doit etre envoyée au
contribuable qui avait fait la demande d'intervention. " & _
                Chr(10) & "Avant l'impression et l'envoi vérifier le contenu
de la lettre" & _
                Chr(10) & Chr(10) & Chr(10) & "Ce message est envoyé par un
robot, ne pas repondre à ce message !"

        email.Subject = "Allô Mairie : Lettre de cloture d'intervention"
        email.Attachments.Add(pj)
        Mail.SmtpMail.SmtpServer = IP_Serveur_Message()
        Mail.SmtpMail.Send(email)
    End Sub


"Nayana" a écrit :

Show quoteHide quote
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
>
Author
6 Dec 2004 5:03 PM
MyriamB
Dim email As New Mail.MailMessage()
        Dim pj As New Mail.MailAttachment(Chemin_Dossier_Lettre() &
"Reponse_Allo_Mairie_" & tableau(0, 5) & ".doc")
                email.To = email_Secretariat()
                email.From = "Technicien_Allo_Mairie"
                email.Body = "Le Technicien vient de cloturer une
intervention. Vous trouverez ci-joint la lettre qui doit etre envoyée au
contribuable qui avait fait la demande d'intervention. " & _
                Chr(10) & "Avant l'impression et l'envoi vérifier le contenu
de la lettre" & _
                Chr(10) & Chr(10) & Chr(10) & "Ce message est envoyé par un
robot, ne pas repondre à ce message !"

        email.Subject = "Allô Mairie : Lettre de cloture d'intervention"
        email.Attachments.Add(pj)
        Mail.SmtpMail.SmtpServer = IP_Serveur_Message()
        Mail.SmtpMail.Send(email)
    End Sub


"Nayana" a écrit :

Show quoteHide quote
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
>
Author
6 Dec 2004 5:03 PM
MyriamB
Dim email As New Mail.MailMessage()
        Dim pj As New Mail.MailAttachment(Chemin_Dossier_Lettre() &
"Reponse_Allo_Mairie_" & tableau(0, 5) & ".doc")
                email.To = email_Secretariat()
                email.From = "Technicien_Allo_Mairie"
                email.Body = "Le Technicien vient de cloturer une
intervention. Vous trouverez ci-joint la lettre qui doit etre envoyée au
contribuable qui avait fait la demande d'intervention. " & _
                Chr(10) & "Avant l'impression et l'envoi vérifier le contenu
de la lettre" & _
                Chr(10) & Chr(10) & Chr(10) & "Ce message est envoyé par un
robot, ne pas repondre à ce message !"

        email.Subject = "Allô Mairie : Lettre de cloture d'intervention"
        email.Attachments.Add(pj)
        Mail.SmtpMail.SmtpServer = IP_Serveur_Message()
        Mail.SmtpMail.Send(email)
    End Sub


"Nayana" a écrit :

Show quoteHide quote
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
>
Author
6 Dec 2004 5:03 PM
MyriamB
Dim email As New Mail.MailMessage()
        Dim pj As New Mail.MailAttachment(Chemin_Dossier_Lettre() &
"Reponse_Allo_Mairie_" & tableau(0, 5) & ".doc")
                email.To = email_Secretariat()
                email.From = "Technicien_Allo_Mairie"
                email.Body = "Le Technicien vient de cloturer une
intervention. Vous trouverez ci-joint la lettre qui doit etre envoyée au
contribuable qui avait fait la demande d'intervention. " & _
                Chr(10) & "Avant l'impression et l'envoi vérifier le contenu
de la lettre" & _
                Chr(10) & Chr(10) & Chr(10) & "Ce message est envoyé par un
robot, ne pas repondre à ce message !"

        email.Subject = "Allô Mairie : Lettre de cloture d'intervention"
        email.Attachments.Add(pj)
        Mail.SmtpMail.SmtpServer = IP_Serveur_Message()
        Mail.SmtpMail.Send(email)
    End Sub


"Nayana" a écrit :

Show quoteHide quote
> hai everybody,
>
> I created a code to retrieve mails from from using vb.net.
> Initially imported outlook.mailitem ,by adding microsoft outlook reference
> in add refernces.
> All the properties except "SenderEmailAddress" is being shown in the
> properties list.
> Can anyone help me out.
> Nayana.
>
>
>
Author
2 Dec 2004 8:07 AM
Markus Hjärne
Hi everybody in this thread,

I think I owe you all, especially you who think I should load less data into
my DataTables, a little better explanation of my design thoughts and what
I'm trying do. I also want to say that it would be interesting to hear what
Kevin Yu or someone else at Microsoft has to say about the problem. I have a
feeling you are out there. :-).

The problem arises just because I try NOT to keep more data in memory than
necessary. Since the database I'm using contains more data than can be held
in memory at one time, the design of the application have to handle that in
some way. The application will also have a rather specialized GUI with tree
views and specialized grids where the user can (and will) navigate around
the objects in many different, and sometimes sophisticated, ways. The user
will also be able to create, modify and delete most of the objects through
the GUI:

So my design idea was that when reading rows from a database table I would
store the rows in a DataTable and also store each DataRow in a business
object which could be used through out the application. Whenever a request
is made to the database, I need to check if there already exists a
corresponding business object for each returned row, because then I want to
reuse that object to ensure that only one business object exists per row in
the database. This was easily accomplished by using a Hashtable with the
DataRow as the key and the corresponding object as the value.

So far so good, but how should I prevent the memory from being exhausted as
the user moves around in the GUI causing more and more rows to be loaded and
business objects to be created? I could manually unload unchanged
objects/rows explicitly, for example when the user collapses a branch in the
tree view. But that would require that I remembered to unload the objects at
all those places and it also felt a little 'undotnetish'.

Then I got the idea to use a WeakReference for the object in the Hashtable
and simple let the garbage collector handle the deallocation of objects when
they aren't used anywhere in the application any longer. But I still have to
do the removal of the deallocated objects corresponding rows in the
DataTable, so I have a Purge method that must be called periodically to
handle this (or maybe I find some way to handle this by a separate thread).

So the bottom line is that with the GC being as unpredictable as it is,
there comes occasions when there are quite a few rows I need to remove from
the DataTable at the same time, and this is where it is very unsatisfactory
that this operation is so slow.

Thanks for all the response so far, but I still nurish the hope that
somebody has a smart idea how to solve this or at least that Microsoft gives
a hint that the performance problem will be looked into in .NET 2.0.

Regards,

Markus Hjarne
Author
3 Dec 2004 7:36 AM
Kawarjit Bedi [MS]
This problem will be addressed in .NET 2.0.

Removing rows from large DataTables is slow in .NET 1.x.   The next version
of .NET 2.0 Beta will contain the fix and performance will be much better.
Remove operation will be almost as fast as the Insert operation. In v1.x,
Remove performance is linear, i,e, it's a function of the number of rows in
the table whereas in .NET 2.0, it'd be logarithmic function.

Note: The existing .NET 2.0 Beta improves row insert / remove performance
over .NET 1.x when indexes / constraints are involved.  For scenarios like
the case being described in this thread where index/constraint are not
involved the performance may not be much different.

Hope it helps.

Kawarjit Bedi
Program Manager - ADO.NET Team
Microsoft Corp.

This posting is provided "AS IS" with no warranties, and confers no rights.


Show quoteHide quote
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
news:uBFtGYE2EHA.924@TK2MSFTNGP14.phx.gbl...
> Hi everybody in this thread,
>
> I think I owe you all, especially you who think I should load less data
into
> my DataTables, a little better explanation of my design thoughts and what
> I'm trying do. I also want to say that it would be interesting to hear
what
> Kevin Yu or someone else at Microsoft has to say about the problem. I have
a
> feeling you are out there. :-).
>
> The problem arises just because I try NOT to keep more data in memory than
> necessary. Since the database I'm using contains more data than can be
held
> in memory at one time, the design of the application have to handle that
in
> some way. The application will also have a rather specialized GUI with
tree
> views and specialized grids where the user can (and will) navigate around
> the objects in many different, and sometimes sophisticated, ways. The user
> will also be able to create, modify and delete most of the objects through
> the GUI:
>
> So my design idea was that when reading rows from a database table I would
> store the rows in a DataTable and also store each DataRow in a business
> object which could be used through out the application. Whenever a request
> is made to the database, I need to check if there already exists a
> corresponding business object for each returned row, because then I want
to
> reuse that object to ensure that only one business object exists per row
in
> the database. This was easily accomplished by using a Hashtable with the
> DataRow as the key and the corresponding object as the value.
>
> So far so good, but how should I prevent the memory from being exhausted
as
> the user moves around in the GUI causing more and more rows to be loaded
and
> business objects to be created? I could manually unload unchanged
> objects/rows explicitly, for example when the user collapses a branch in
the
> tree view. But that would require that I remembered to unload the objects
at
> all those places and it also felt a little 'undotnetish'.
>
> Then I got the idea to use a WeakReference for the object in the Hashtable
> and simple let the garbage collector handle the deallocation of objects
when
> they aren't used anywhere in the application any longer. But I still have
to
> do the removal of the deallocated objects corresponding rows in the
> DataTable, so I have a Purge method that must be called periodically to
> handle this (or maybe I find some way to handle this by a separate
thread).
>
> So the bottom line is that with the GC being as unpredictable as it is,
> there comes occasions when there are quite a few rows I need to remove
from
> the DataTable at the same time, and this is where it is very
unsatisfactory
> that this operation is so slow.
>
> Thanks for all the response so far, but I still nurish the hope that
> somebody has a smart idea how to solve this or at least that Microsoft
gives
> a hint that the performance problem will be looked into in .NET 2.0.
>
> Regards,
>
> Markus Hjarne
>
>
>
Author
3 Dec 2004 8:02 AM
Markus Hjärne
Thanks!

It really warms my heart to know that you are listened to. It won't help
with my immediate problem, but now I feel that I can keep my design and the
performance problems will eventually be solved. Hopefully I, or some clever
person out there, will come up with a acceptable workaround until then.

For a moment, I actually thought I had come up with a workaround when my
testing using a raw ArrayList showed that RemoveAt was so much faster than
Remove (which wasn't so surprising since RemoveAt doesn't have to lookup the
index). But unfortunately DataRowCollection.RemoveAt wasn't any faster than
Remove, and that surprised me a bit.

Anyway, thanks again!

Regards,

Markus Hjarne
LandFocus
Sweden



Show quoteHide quote
"Kawarjit Bedi [MS]" <kb***@online.microsoft.com> skrev i meddelandet
news:41b0178c$1@news.microsoft.com...
> This problem will be addressed in .NET 2.0.
>
> Removing rows from large DataTables is slow in .NET 1.x.   The next
version
> of .NET 2.0 Beta will contain the fix and performance will be much better.
> Remove operation will be almost as fast as the Insert operation. In v1.x,
> Remove performance is linear, i,e, it's a function of the number of rows
in
> the table whereas in .NET 2.0, it'd be logarithmic function.
>
> Note: The existing .NET 2.0 Beta improves row insert / remove performance
> over .NET 1.x when indexes / constraints are involved.  For scenarios like
> the case being described in this thread where index/constraint are not
> involved the performance may not be much different.
>
> Hope it helps.
>
> Kawarjit Bedi
> Program Manager - ADO.NET Team
> Microsoft Corp.
>
> This posting is provided "AS IS" with no warranties, and confers no
rights.
>
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> news:uBFtGYE2EHA.924@TK2MSFTNGP14.phx.gbl...
> > Hi everybody in this thread,
> >
> > I think I owe you all, especially you who think I should load less data
> into
> > my DataTables, a little better explanation of my design thoughts and
what
> > I'm trying do. I also want to say that it would be interesting to hear
> what
> > Kevin Yu or someone else at Microsoft has to say about the problem. I
have
> a
> > feeling you are out there. :-).
> >
> > The problem arises just because I try NOT to keep more data in memory
than
> > necessary. Since the database I'm using contains more data than can be
> held
> > in memory at one time, the design of the application have to handle that
> in
> > some way. The application will also have a rather specialized GUI with
> tree
> > views and specialized grids where the user can (and will) navigate
around
> > the objects in many different, and sometimes sophisticated, ways. The
user
> > will also be able to create, modify and delete most of the objects
through
> > the GUI:
> >
> > So my design idea was that when reading rows from a database table I
would
> > store the rows in a DataTable and also store each DataRow in a business
> > object which could be used through out the application. Whenever a
request
> > is made to the database, I need to check if there already exists a
> > corresponding business object for each returned row, because then I want
> to
> > reuse that object to ensure that only one business object exists per row
> in
> > the database. This was easily accomplished by using a Hashtable with the
> > DataRow as the key and the corresponding object as the value.
> >
> > So far so good, but how should I prevent the memory from being exhausted
> as
> > the user moves around in the GUI causing more and more rows to be loaded
> and
> > business objects to be created? I could manually unload unchanged
> > objects/rows explicitly, for example when the user collapses a branch in
> the
> > tree view. But that would require that I remembered to unload the
objects
> at
> > all those places and it also felt a little 'undotnetish'.
> >
> > Then I got the idea to use a WeakReference for the object in the
Hashtable
> > and simple let the garbage collector handle the deallocation of objects
> when
> > they aren't used anywhere in the application any longer. But I still
have
> to
> > do the removal of the deallocated objects corresponding rows in the
> > DataTable, so I have a Purge method that must be called periodically to
> > handle this (or maybe I find some way to handle this by a separate
> thread).
> >
> > So the bottom line is that with the GC being as unpredictable as it is,
> > there comes occasions when there are quite a few rows I need to remove
> from
> > the DataTable at the same time, and this is where it is very
> unsatisfactory
> > that this operation is so slow.
> >
> > Thanks for all the response so far, but I still nurish the hope that
> > somebody has a smart idea how to solve this or at least that Microsoft
> gives
> > a hint that the performance problem will be looked into in .NET 2.0.
> >
> > Regards,
> >
> > Markus Hjarne
> >
> >
> >
>
>
Author
6 Dec 2004 7:16 AM
Sahil Malik
Markus,

Here is why -

public void RemoveAt(int index)
{
      this.Remove(this[index]);
}

RemoveAt calls Remove in DataRowCollection - which is why no performance
difference.

;-)

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik



Show quoteHide quote
"Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
news:u5gk%235Q2EHA.1524@TK2MSFTNGP09.phx.gbl...
> Thanks!
>
> It really warms my heart to know that you are listened to. It won't help
> with my immediate problem, but now I feel that I can keep my design and
> the
> performance problems will eventually be solved. Hopefully I, or some
> clever
> person out there, will come up with a acceptable workaround until then.
>
> For a moment, I actually thought I had come up with a workaround when my
> testing using a raw ArrayList showed that RemoveAt was so much faster than
> Remove (which wasn't so surprising since RemoveAt doesn't have to lookup
> the
> index). But unfortunately DataRowCollection.RemoveAt wasn't any faster
> than
> Remove, and that surprised me a bit.
>
> Anyway, thanks again!
>
> Regards,
>
> Markus Hjarne
> LandFocus
> Sweden
>
>
>
> "Kawarjit Bedi [MS]" <kb***@online.microsoft.com> skrev i meddelandet
> news:41b0178c$1@news.microsoft.com...
>> This problem will be addressed in .NET 2.0.
>>
>> Removing rows from large DataTables is slow in .NET 1.x.   The next
> version
>> of .NET 2.0 Beta will contain the fix and performance will be much
>> better.
>> Remove operation will be almost as fast as the Insert operation. In v1.x,
>> Remove performance is linear, i,e, it's a function of the number of rows
> in
>> the table whereas in .NET 2.0, it'd be logarithmic function.
>>
>> Note: The existing .NET 2.0 Beta improves row insert / remove performance
>> over .NET 1.x when indexes / constraints are involved.  For scenarios
>> like
>> the case being described in this thread where index/constraint are not
>> involved the performance may not be much different.
>>
>> Hope it helps.
>>
>> Kawarjit Bedi
>> Program Manager - ADO.NET Team
>> Microsoft Corp.
>>
>> This posting is provided "AS IS" with no warranties, and confers no
> rights.
>>
>>
>> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
>> news:uBFtGYE2EHA.924@TK2MSFTNGP14.phx.gbl...
>> > Hi everybody in this thread,
>> >
>> > I think I owe you all, especially you who think I should load less data
>> into
>> > my DataTables, a little better explanation of my design thoughts and
> what
>> > I'm trying do. I also want to say that it would be interesting to hear
>> what
>> > Kevin Yu or someone else at Microsoft has to say about the problem. I
> have
>> a
>> > feeling you are out there. :-).
>> >
>> > The problem arises just because I try NOT to keep more data in memory
> than
>> > necessary. Since the database I'm using contains more data than can be
>> held
>> > in memory at one time, the design of the application have to handle
>> > that
>> in
>> > some way. The application will also have a rather specialized GUI with
>> tree
>> > views and specialized grids where the user can (and will) navigate
> around
>> > the objects in many different, and sometimes sophisticated, ways. The
> user
>> > will also be able to create, modify and delete most of the objects
> through
>> > the GUI:
>> >
>> > So my design idea was that when reading rows from a database table I
> would
>> > store the rows in a DataTable and also store each DataRow in a business
>> > object which could be used through out the application. Whenever a
> request
>> > is made to the database, I need to check if there already exists a
>> > corresponding business object for each returned row, because then I
>> > want
>> to
>> > reuse that object to ensure that only one business object exists per
>> > row
>> in
>> > the database. This was easily accomplished by using a Hashtable with
>> > the
>> > DataRow as the key and the corresponding object as the value.
>> >
>> > So far so good, but how should I prevent the memory from being
>> > exhausted
>> as
>> > the user moves around in the GUI causing more and more rows to be
>> > loaded
>> and
>> > business objects to be created? I could manually unload unchanged
>> > objects/rows explicitly, for example when the user collapses a branch
>> > in
>> the
>> > tree view. But that would require that I remembered to unload the
> objects
>> at
>> > all those places and it also felt a little 'undotnetish'.
>> >
>> > Then I got the idea to use a WeakReference for the object in the
> Hashtable
>> > and simple let the garbage collector handle the deallocation of objects
>> when
>> > they aren't used anywhere in the application any longer. But I still
> have
>> to
>> > do the removal of the deallocated objects corresponding rows in the
>> > DataTable, so I have a Purge method that must be called periodically to
>> > handle this (or maybe I find some way to handle this by a separate
>> thread).
>> >
>> > So the bottom line is that with the GC being as unpredictable as it is,
>> > there comes occasions when there are quite a few rows I need to remove
>> from
>> > the DataTable at the same time, and this is where it is very
>> unsatisfactory
>> > that this operation is so slow.
>> >
>> > Thanks for all the response so far, but I still nurish the hope that
>> > somebody has a smart idea how to solve this or at least that Microsoft
>> gives
>> > a hint that the performance problem will be looked into in .NET 2.0.
>> >
>> > Regards,
>> >
>> > Markus Hjarne
>> >
>> >
>> >
>>
>>
>
>
Author
9 Dec 2004 7:15 AM
Markus Hjärne
Thanks,

that explains it.

/Markus

Show quoteHide quote
"Sahil Malik" <contactmethrumyblog@nospam.com> skrev i meddelandet
news:uRUt4N22EHA.3820@TK2MSFTNGP11.phx.gbl...
> Markus,
>
> Here is why -
>
> public void RemoveAt(int index)
> {
>       this.Remove(this[index]);
> }
>
> RemoveAt calls Remove in DataRowCollection - which is why no performance
> difference.
>
> ;-)
>
> - Sahil Malik
> http://dotnetjunkies.com/weblog/sahilmalik
>
>
>
> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> news:u5gk%235Q2EHA.1524@TK2MSFTNGP09.phx.gbl...
> > Thanks!
> >
> > It really warms my heart to know that you are listened to. It won't help
> > with my immediate problem, but now I feel that I can keep my design and
> > the
> > performance problems will eventually be solved. Hopefully I, or some
> > clever
> > person out there, will come up with a acceptable workaround until then.
> >
> > For a moment, I actually thought I had come up with a workaround when my
> > testing using a raw ArrayList showed that RemoveAt was so much faster
than
> > Remove (which wasn't so surprising since RemoveAt doesn't have to lookup
> > the
> > index). But unfortunately DataRowCollection.RemoveAt wasn't any faster
> > than
> > Remove, and that surprised me a bit.
> >
> > Anyway, thanks again!
> >
> > Regards,
> >
> > Markus Hjarne
> > LandFocus
> > Sweden
> >
> >
> >
> > "Kawarjit Bedi [MS]" <kb***@online.microsoft.com> skrev i meddelandet
> > news:41b0178c$1@news.microsoft.com...
> >> This problem will be addressed in .NET 2.0.
> >>
> >> Removing rows from large DataTables is slow in .NET 1.x.   The next
> > version
> >> of .NET 2.0 Beta will contain the fix and performance will be much
> >> better.
> >> Remove operation will be almost as fast as the Insert operation. In
v1.x,
> >> Remove performance is linear, i,e, it's a function of the number of
rows
> > in
> >> the table whereas in .NET 2.0, it'd be logarithmic function.
> >>
> >> Note: The existing .NET 2.0 Beta improves row insert / remove
performance
> >> over .NET 1.x when indexes / constraints are involved.  For scenarios
> >> like
> >> the case being described in this thread where index/constraint are not
> >> involved the performance may not be much different.
> >>
> >> Hope it helps.
> >>
> >> Kawarjit Bedi
> >> Program Manager - ADO.NET Team
> >> Microsoft Corp.
> >>
> >> This posting is provided "AS IS" with no warranties, and confers no
> > rights.
> >>
> >>
> >> "Markus Hjärne" <markus.hjarne@NOSPAMlandfocus.se> wrote in message
> >> news:uBFtGYE2EHA.924@TK2MSFTNGP14.phx.gbl...
> >> > Hi everybody in this thread,
> >> >
> >> > I think I owe you all, especially you who think I should load less
data
> >> into
> >> > my DataTables, a little better explanation of my design thoughts and
> > what
> >> > I'm trying do. I also want to say that it would be interesting to
hear
> >> what
> >> > Kevin Yu or someone else at Microsoft has to say about the problem. I
> > have
> >> a
> >> > feeling you are out there. :-).
> >> >
> >> > The problem arises just because I try NOT to keep more data in memory
> > than
> >> > necessary. Since the database I'm using contains more data than can
be
> >> held
> >> > in memory at one time, the design of the application have to handle
> >> > that
> >> in
> >> > some way. The application will also have a rather specialized GUI
with
> >> tree
> >> > views and specialized grids where the user can (and will) navigate
> > around
> >> > the objects in many different, and sometimes sophisticated, ways. The
> > user
> >> > will also be able to create, modify and delete most of the objects
> > through
> >> > the GUI:
> >> >
> >> > So my design idea was that when reading rows from a database table I
> > would
> >> > store the rows in a DataTable and also store each DataRow in a
business
> >> > object which could be used through out the application. Whenever a
> > request
> >> > is made to the database, I need to check if there already exists a
> >> > corresponding business object for each returned row, because then I
> >> > want
> >> to
> >> > reuse that object to ensure that only one business object exists per
> >> > row
> >> in
> >> > the database. This was easily accomplished by using a Hashtable with
> >> > the
> >> > DataRow as the key and the corresponding object as the value.
> >> >
> >> > So far so good, but how should I prevent the memory from being
> >> > exhausted
> >> as
> >> > the user moves around in the GUI causing more and more rows to be
> >> > loaded
> >> and
> >> > business objects to be created? I could manually unload unchanged
> >> > objects/rows explicitly, for example when the user collapses a branch
> >> > in
> >> the
> >> > tree view. But that would require that I remembered to unload the
> > objects
> >> at
> >> > all those places and it also felt a little 'undotnetish'.
> >> >
> >> > Then I got the idea to use a WeakReference for the object in the
> > Hashtable
> >> > and simple let the garbage collector handle the deallocation of
objects
> >> when
> >> > they aren't used anywhere in the application any longer. But I still
> > have
> >> to
> >> > do the removal of the deallocated objects corresponding rows in the
> >> > DataTable, so I have a Purge method that must be called periodically
to
> >> > handle this (or maybe I find some way to handle this by a separate
> >> thread).
> >> >
> >> > So the bottom line is that with the GC being as unpredictable as it
is,
> >> > there comes occasions when there are quite a few rows I need to
remove
> >> from
> >> > the DataTable at the same time, and this is where it is very
> >> unsatisfactory
> >> > that this operation is so slow.
> >> >
> >> > Thanks for all the response so far, but I still nurish the hope that
> >> > somebody has a smart idea how to solve this or at least that
Microsoft
> >> gives
> >> > a hint that the performance problem will be looked into in .NET 2.0.
> >> >
> >> > Regards,
> >> >
> >> > Markus Hjarne
> >> >
> >> >
> >> >
> >>
> >>
> >
> >
>
>

Bookmark and Share