473,890 Members | 1,705 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

how to keep the rows ordering of datatable unchanged?

2 New Member
I have a datatable with the ordering of its DataClassIndex column before editting:

DataclassIndex 0 1 2 3 4

When I start modifying some other cells in this datatable, the ordering of DataClassIndex column changes to something like this

DataclassIndex 3 4 2 1 0

How can I modify a datatable content without altering the original order of the datatable.
Jul 6 '10 #1
3 2201
9,735 Recognized Expert Moderator Expert
Your question doesn't make sense to me.
A DataTable is just a table that contains a bunch of data in it.

What do you mean when you say the DataClassIndex changes?

Does the underlying data in the DataTable change (if so, why does it change? This doesn't happen without you doing something to it)

Or are you talking about a GridView displaying the DataTable data...and how the rows could possibly change if the user sorts the GridView??

Jul 13 '10 #2
2 New Member
When I tried to modify some data in the datatable, the ordering of rows get changed. DataClassIndex is the name of the column in the datatable which contains the index of the rows of the datatable. Again, changing the data for some cells in the datatable alters the ordering of rows in the datatable which is not what I want. Thanks.
Jul 13 '10 #3
9,735 Recognized Expert Moderator Expert
I've never heard of this.
Either you have some "sorting" going on in the control that is displaying the DataTable or you have some logic/code that is modifying the order of the rows. I can't guess at what you are doing that may be causing this problem...
Jul 14 '10 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: MrNobody | last post by:
I've read that the expression property for DataColumns is used to "Sets or retrieves the expresssion used to filter rows, calculate the values in a column, or create an aggregate column.". I have seen examples on how to filter a column, but how would I filter out an entire row depending on the value of a column? For example, if I wanted to filter out every row in a multi-column table where the "Is Fubar" column equals "true", how would...
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);
by: shankar | last post by:
Hi all, This is the way to append the rows from one datatable into another with the same schema. Here Temp and Temp1 are the datatables For Each rows As DataRow In tempTable.Rows Temp1 .NewRow() Temp1 .ImportRow(rows)
by: JL | last post by:
Hi all, I want to sort the rows in dataTable and the order of rows is permanent change, is this possible in dataTable? Thanks a lot.
by: Brett Romero | last post by:
I keep getting this error with the following code: This row already belongs to another table DataSet ds = new DataSet(); DataTable dtPersonID = new DataTable(); dtPersonID.Columns.Add("PersonID"); foreach (DataRow dr in dt.Rows) { dtPersonID.Rows.Add(dr); }
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:
by: srinivas | last post by:
HI, I have 4 text boxes and one button in my page. When ever I fill the text boxes and click the button the data should be add to a datagrid with out inserting a record in database. For this I used datatable to insert the records but when ever I click the add button my aspx page is submitting. When page submits new datatable instance is creating and I lost old data. How can we keep old rows and ad new datarow in data table. Sorry for my...
by: qialexandrew | last post by:
Hi all, I used DataTable to retrieve information from MySQL database. I expect to have 4 rows returned in the DataTable(I tried the same query in MySql Query Browser), however I got 6. The code fragment is as following MySqlDataAdapter dataAdapter = new MySqlDataAdapter(); DataTable resultTable = new DataTable(); MySqlCommand command = new MySqlCommand(); command.CommandText = "SELECT im_id, im_title FROM imgfinfo WHERE im_albumid = 5";...
by: sudhaMurugesan | last post by:
Hi all, I am importing data from excel sheet. i get the data in a datatable. when there are empty rows in excel i am getting empty rows in datatable also. how to remove empty rows? help me please. Thanks & Regards
by: ArunDhaJ | last post by:
Hi, Can we write custom function to filter rows from DataTable Select method? Actually my need is to format the row value from (901) 789 1234<BR>(901) 789 1235<BR>(901) 789 1221 to 9017891234<BR>9017891235<BR>9017891221 (removing all formatting strings)
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,...
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...
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...
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...
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...
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
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
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.