PC Review


Reply
Thread Tools Rate Thread

Cannnot add new record to a datatable after sorting

 
 
Young
Guest
Posts: n/a
 
      17th Aug 2009
I got a table with just 1 primary key (a short integer field).

If I sort the datatable, I cannot add a new record anymore. I keep getting
an error saying that the record is a duplicate (the primary key is unique
and definitely not a duplicate).

If I don't sort the datatable, then I can add without any problem.

I sort the datatable using these codes:

myTable.DefaultView.Sort = "MYKEY"
myTable = myTable.DefaultView.ToTable.

Can someone please help?

TIA
YL



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Sorting A DataTable David P. Donahue Microsoft C# .NET 6 23rd Jun 2006 04:57 PM
Sorting DataTable =?Utf-8?B?V0I=?= Microsoft Dot NET 3 21st Feb 2006 07:59 AM
sorting in DataTable Grey Microsoft ASP .NET 3 13th Sep 2004 08:34 AM
Sorting a DataTable... Colin Basterfield Microsoft ADO .NET 2 19th Jan 2004 07:02 PM
Sorting Datatable scorpion53061 Microsoft ADO .NET 1 28th Aug 2003 11:53 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 12:51 AM.