473,667 Members | 2,670 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 7142
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> ¼¶¼g©ó¶l¥ó·s»D: %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>
¼¶¼g©ó¶l¥ó·s»D: %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
15735
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
10061
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
16267
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
12603
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
5399
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
6601
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
2948
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
3745
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
11072
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
8366
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8790
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8565
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
8650
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
7391
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6206
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
5677
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();...
2
2017
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1779
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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

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