473,724 Members | 2,279 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

DataTable.remov e 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.Sele ct("check = false ")
Me.dtRvDetail.R ows.Remove(myDe lRowArray) <-- I know there is error, since i
cannot delete the datarowarray.

Any simple and easy way ??
thanks a lot

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

Something like:

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

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

Hope this helps
Jay

"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:ui******** ******@TK2MSFTN GP15.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.Sele ct("check = false ")
| Me.dtRvDetail.R ows.Remove(myDe lRowArray) <-- 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> 撰寫於郵件新聞: %2************* ***@TK2MSFTNGP0 9.phx.gbl...
Agnes,
Use a for each on your DataRow array removing each entry.

Something like:

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

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

Hope this helps
Jay

"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:ui******** ******@TK2MSFTN GP15.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.Sele ct("check = false ")
| Me.dtRvDetail.R ows.Remove(myDe lRowArray) <-- 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.240345 6 (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.Clon e()
For Each row As DataRow In dtRvDetail.Sele ct("check = true")
checked.ImportR ow(row)
Next

Then any further processing occurs on checked instead of dtRvDetail.

Hope this helps
Jay

"Agnes" <ag***@dynamict ech.com.hk> wrote in message
news:%2******** ********@TK2MSF TNGP14.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>
撰寫於郵件新聞: %2************* ***@TK2MSFTNGP0 9.phx.gbl...
| > Agnes,
| > Use a for each on your DataRow array removing each entry.
| >
| > Something like:
| >
| > For Each row As DataRow In dtRvDetail.Sele ct("check = false ")
| > dtRvDetail.Rows .Remove(row)
| > Next
| >
| > Because DataTable.Selec t returns an array of Rows, you can safely remove
| > the
| > rows from the underlying DataTable.Rows collection.
| >
| > Hope this helps
| > Jay
| >
| > "Agnes" <ag***@dynamict ech.com.hk> wrote in message
| > news:ui******** ******@TK2MSFTN GP15.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.Sele ct("check = false ")
| > | Me.dtRvDetail.R ows.Remove(myDe lRowArray) <-- 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
15742
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
10084
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 table is each of them isn't on a stirng, but right no I have to do it in a wat of: 1. passing DataTable to method (lets call it SelectOverDataTabel) 2. declare a local (in SelectOver...) DataTable, inicialize it with my value
5
16275
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 below. _currentEntryBE.Tables.Rows.Remove(dr); DataTable dt = _currentEntryBE.Tables.GetChanges(System.Data.DataRowState.Detached);
3
12623
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 this point.) Anyone have any ideas? Thanks ==================================================== private void button1_Click(object sender, System.EventArgs e)
3
5407
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 example first:
7
6606
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 include them in the set that is displayed to the user) but I don't want to delete the corresponding row from the database. I've tried using the .Rows.Remove() method but an exception is thrown to say I don't have a 'delete' command in the data...
4
2953
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 changed or updated the server in any way. "There is no row at position 42" at System.Data.RBTree`1.GetNodeByIndex(int32 userIndex) at System.Data.DataTable.Clear(Boolean clearAll) at system.Data.DataTable.Clear()
5
3746
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 great, but if the user selects another item from the dropdown field and the sub runs again, the original data is overwritten. How do I store the original data and add the new datarow without overwriting the original? Here's my code: Protected...
8
11090
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 then I make the datagrid.datasource = myds.Tables(0) or mydt. Now what I want is to be able to change the query and click the button again and get the new results. I can use clear() to clear the data from a ds/dt but I need the structure gone...
0
9388
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9160
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9090
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8062
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6685
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupr who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5996
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4764
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3209
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2612
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.