473,322 Members | 1,259 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,322 software developers and data experts.

DataTable.remove problem

I need to Load 4thousand record into a datagrid for the user to choose.
After the user click the row, I will save it.
Now, How can I remove the uncheck row.
Dim myDelRowArray() As DataRow = dtRvDetail.Select("check = false ")
Me.dtRvDetail.Rows.Remove(myDelRowArray) <-- I know there is error, since i
cannot delete the datarowarray.

Any simple and easy way ??
thanks a lot

Nov 21 '05 #1
3 7124
Agnes,
Use a for each on your DataRow array removing each entry.

Something like:

For Each row As DataRow In dtRvDetail.Select("check = false ")
dtRvDetail.Rows.Remove(row)
Next

Because DataTable.Select returns an array of Rows, you can safely remove the
rows from the underlying DataTable.Rows collection.

Hope this helps
Jay

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:ui**************@TK2MSFTNGP15.phx.gbl...
|I need to Load 4thousand record into a datagrid for the user to choose.
| After the user click the row, I will save it.
| Now, How can I remove the uncheck row.
| Dim myDelRowArray() As DataRow = dtRvDetail.Select("check = false ")
| Me.dtRvDetail.Rows.Remove(myDelRowArray) <-- I know there is error, since
i
| cannot delete the datarowarray.
|
| Any simple and easy way ??
| thanks a lot
|
|
|
Nov 21 '05 #2
Thanks Jay,
I try the following for-loop before, However, my table got 4000 records. it
takes too many times to remove it.
over 5-8 minutes. my client complaint that.
"Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com> ¼¶¼g©ó¶l¥ó·s»D:%2****************@TK2MSFTNGP09.phx .gbl...
Agnes,
Use a for each on your DataRow array removing each entry.

Something like:

For Each row As DataRow In dtRvDetail.Select("check = false ")
dtRvDetail.Rows.Remove(row)
Next

Because DataTable.Select returns an array of Rows, you can safely remove
the
rows from the underlying DataTable.Rows collection.

Hope this helps
Jay

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:ui**************@TK2MSFTNGP15.phx.gbl...
|I need to Load 4thousand record into a datagrid for the user to choose.
| After the user click the row, I will save it.
| Now, How can I remove the uncheck row.
| Dim myDelRowArray() As DataRow = dtRvDetail.Select("check = false ")
| Me.dtRvDetail.Rows.Remove(myDelRowArray) <-- I know there is error,
since
i
| cannot delete the datarowarray.
|
| Any simple and easy way ??
| thanks a lot
|
|
|

Nov 21 '05 #3
Agnes,
| I try the following for-loop before, However, my table got 4000 records.
it
| takes too many times to remove it.
| over 5-8 minutes. my client complaint that.
The code I gave should take fractions of a second. 5 -8 seconds tops! On my
Pentium III 866 its takes 00:00:00.2403456 (thats .24 seconds) to delete
3999 rows.

What size of a machine are you running on?
How much memory?
What OS?
What is is going on on the machine?
Instead of removing the "check = false" rows, have you considered importing
the "check = true" rows into a new (cloned) datatable?

Something like:
Dim checked As DataTable = dtRvDetail.Clone()
For Each row As DataRow In dtRvDetail.Select("check = true")
checked.ImportRow(row)
Next

Then any further processing occurs on checked instead of dtRvDetail.

Hope this helps
Jay

"Agnes" <ag***@dynamictech.com.hk> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
| Thanks Jay,
| I try the following for-loop before, However, my table got 4000 records.
it
| takes too many times to remove it.
| over 5-8 minutes. my client complaint that.
| "Jay B. Harlow [MVP - Outlook]" <Ja************@msn.com>
¼¶¼g©ó¶l¥ó·s»D:%2****************@TK2MSFTNGP09.phx .gbl...
| > Agnes,
| > Use a for each on your DataRow array removing each entry.
| >
| > Something like:
| >
| > For Each row As DataRow In dtRvDetail.Select("check = false ")
| > dtRvDetail.Rows.Remove(row)
| > Next
| >
| > Because DataTable.Select returns an array of Rows, you can safely remove
| > the
| > rows from the underlying DataTable.Rows collection.
| >
| > Hope this helps
| > Jay
| >
| > "Agnes" <ag***@dynamictech.com.hk> wrote in message
| > news:ui**************@TK2MSFTNGP15.phx.gbl...
| > |I need to Load 4thousand record into a datagrid for the user to choose.
| > | After the user click the row, I will save it.
| > | Now, How can I remove the uncheck row.
| > | Dim myDelRowArray() As DataRow = dtRvDetail.Select("check = false ")
| > | Me.dtRvDetail.Rows.Remove(myDelRowArray) <-- I know there is error,
| > since
| > i
| > | cannot delete the datarowarray.
| > |
| > | Any simple and easy way ??
| > | thanks a lot
| > |
| > |
| > |
| >
| >
|
|
Nov 21 '05 #4

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

Similar topics

1
by: frank | last post by:
I have two DataTables, A and B. Both have the primary key "CID". How do I remove all entries in Table A from Table B (with the same PK)?
5
by: Stefan Turalski \(stic\) | last post by:
Hi, I'm wondering if there is a way to send a method parametrs by ref when DataTabel is a type of this value ? I done some sort of select over DataTable columns, just by removing them froma...
5
by: jurson | last post by:
Hello, I remove row from DataTable. It works ok, the row is removed from collection. It should be marked as 'detached'. Am I right? Then I try to retrieve 'detached' rows using the code shown...
3
by: a | last post by:
Hi: I'm trying to add rows to a datatable from an array, but due to lack of brain power, am unable to make this work. I'm being told that I don't have enough columns (I only want one column at...
3
by: Niyazi | last post by:
Hi all, I have a dataTable that contains nearly 38400 rows. In the dataTable consist of 3 column. column 1 Name: MUHNO column 2 Name: HESNO Column 3 Name: BALANCE Let me give you some...
7
by: Susan Mackay | last post by:
I have a data table that is connected to a database table with a data adapter in the 'standard' manner. However I want to be able to remove selected rows from the data table (i.e. no longer...
4
by: Adrian Parker | last post by:
We've suddenly started getting a problem with a call to clear the contents of a DataTable. This is on a live customer site that's been working fine until yesterday. As far as we know they've not...
5
by: =?Utf-8?B?SnVsaWEgQg==?= | last post by:
Hi, I wonder if anyone can help? I've got a web form (intranet), .net version 1.1. I've got a sub that populates a datatable in a dataset, dependent on a dropdown field selection. This works...
8
by: cj | last post by:
I have a program to display queries to a SQL db. I type my query in a textbox and click a button and the results display in a datagrid. I could use either dataset or datatable to read the data in...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...

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

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