c# - DataView.Count different DataView.Table.Rows.Count -


I am using C # and .NET 3.5, and there is a gridview that I want to get the data- Back in the page I am setting. I have the data in the datatable and then based on the column value of each line (isigalid booolan), I create a new row in 1 of 2 datawaves - dvValid or dvInvalid using the DataRowView.AddNew () method. I'm not creating a new DataTable.NewRow to add to the DataView table, then I bind the GridView in the appropriate data view.

There is a problem when I'm sorting GridView. I'm having a problem with a line, not being sorted properly, all the other rows are sorted properly. I debug my code and found that DataView.Count is more than DataView.Table.Rows.Count.Count, although I'm calling the DataView.Table.AcceptChanges () method. This is strange because all the committed rows should be in the datatable and therefore the calculation should be same.

So why are there 2 different variations? DataView is a subset of datatale, so it should not have equal or lower rows than datatellas. When I populate the dataview, should I make datatable before making dataView directly? Right now, I am making a data reviewview directly without DDATTables, is this the right way?

Thank you for your help

Code Snippet: C #

...

  // Forms of Data Tables Get data in = GetMemberDataTable (); // dvValidMembers = New DataView (CreateMembersDT ("ValidMembers")) to create a view with any rows from a new datagram;) DvInValidMembers = New Data View (CreateMembersDT ("Invalid Member")); // Repeat through each line and insert in the appropriate datawave foreach (make rows in the datator member member.) (If ((bool member member Rao ["isValid"]) Add members to valid members dv.videmembers.AddNew () ; Else // Add InValid members to the Deviation member = dvInvalidMembers.AddNew (); Member ["Member ID"] = Member Rau ["MEMID"];} // foreach dvInvalidMembers.Table.AcceptChanges (); dvValidMembers.Table.AcceptChanges ();} Personal System .DataTableMemberDT (string tablename) {System.Data.D AtaTable dtMembers = New System.Data.DataTable (tableName); DtMembers.Columns.Add (New DataColumn ("memID", typef (int)); Returning Ditmers;}  
< P>

This 1 line which is not sorted correctly, this can be the last line?

I think you have a DataView .EndEdit () are unavailable:

  foreach (DataRow memberRow members.Rows) {DataView DV; if (...) // Include valid members; DV DV = dvValidMembers; Else dv = dvInvalidMembers; Members = DV Adenu (); Member ["member id"] = member rau ["mmed"]; Dv.EndEdit (); }  

But I would also like to note that you can probably use 2 views with a filter at isvalid and then you can only use them in the original Must indicate the member table


Comments

Popular posts from this blog

asp.net - Javascript/DOM Why is does my form not support submit()? -

sockets - Delphi: TTcpServer, connection reset when reading -

javascript - Classic ASP "ExecuteGlobal" statement acting differently on two servers -