Click here to Skip to main content
15,894,646 members
Home / Discussions / C#
   

C#

 
GeneralRe: Global Logger instance Pin
leppie24-Jul-03 7:15
leppie24-Jul-03 7:15 
GeneralRe: Global Logger instance Pin
Julian Bucknall [MSFT]24-Jul-03 9:00
Julian Bucknall [MSFT]24-Jul-03 9:00 
GeneralRe: Global Logger instance Pin
StealthyMark26-Jul-03 14:41
StealthyMark26-Jul-03 14:41 
Generallaunch & run cmd.exe Pin
nam2324-Jul-03 5:20
nam2324-Jul-03 5:20 
GeneralRe: launch & run cmd.exe Pin
Tom Archer24-Jul-03 5:28
Tom Archer24-Jul-03 5:28 
GeneralRe: launch & run cmd.exe Pin
Tom Archer24-Jul-03 5:31
Tom Archer24-Jul-03 5:31 
GeneralRe: launch & run cmd.exe Pin
nam2324-Jul-03 6:19
nam2324-Jul-03 6:19 
QuestionHow to swap primary key values in a DataTable? Pin
Radoslav Bielik24-Jul-03 4:35
Radoslav Bielik24-Jul-03 4:35 
Hello,

Is it possible to easily swap values of primary key column between two rows of one DataTable object? I've been trying it like this;
<br />
DataRow dr1=dt.Rows.Find(5); //dt being a DataTable instance<br />
DataRow dr2=dt.Rows.Find(10);<br />
dr1.BeginEdit();<br />
dr2.BeginEdit();<br />
dr1["item_Id"]=10;<br />
dr2["item_Id"]=5;<br />
dr1.EndEdit(); //this will throw an exception, <br />
               //because dr2's PK still has a value of 10<br />
dr2.EndEdit();<br />


Same thing happens with dt.AcceptChanges();
Is there a way how to achieve this? Any clues are highly appreciated!

Rado
AnswerRe: How to swap primary key values in a DataTable? Pin
Tom Archer24-Jul-03 7:21
Tom Archer24-Jul-03 7:21 
GeneralRe: How to swap primary key values in a DataTable? Pin
Radoslav Bielik24-Jul-03 7:33
Radoslav Bielik24-Jul-03 7:33 
GeneralRe: How to swap primary key values in a DataTable? Pin
Tom Archer24-Jul-03 7:37
Tom Archer24-Jul-03 7:37 
GeneralRe: How to swap primary key values in a DataTable? Pin
Tom Archer5-Aug-03 12:39
Tom Archer5-Aug-03 12:39 
AnswerRe: How to swap primary key values in a DataTable? Pin
StealthyMark26-Jul-03 14:50
StealthyMark26-Jul-03 14:50 
GeneralRe: How to swap primary key values in a DataTable? Pin
Radoslav Bielik27-Jul-03 11:49
Radoslav Bielik27-Jul-03 11:49 
GeneralGeneric / Text Only print Pin
MadsJ24-Jul-03 3:13
MadsJ24-Jul-03 3:13 
GeneralRe: Generic / Text Only print Pin
Ista24-Jul-03 6:52
Ista24-Jul-03 6:52 
GeneralRe: Generic / Text Only print Pin
MadsJ24-Jul-03 19:41
MadsJ24-Jul-03 19:41 
GeneralRe: Generic / Text Only print Pin
J. Dunlap24-Jul-03 20:13
J. Dunlap24-Jul-03 20:13 
GeneralRe: Generic / Text Only print Pin
Ista25-Jul-03 4:15
Ista25-Jul-03 4:15 
GeneralProcess Monitoring Pin
vikramlinux24-Jul-03 1:56
vikramlinux24-Jul-03 1:56 
GeneralRe: Process Monitoring Pin
Tom Archer24-Jul-03 2:18
Tom Archer24-Jul-03 2:18 
GeneralCreate Bitmap and LockBits Pin
novachen24-Jul-03 0:51
novachen24-Jul-03 0:51 
GeneralRe: Create Bitmap and LockBits Pin
leppie24-Jul-03 7:26
leppie24-Jul-03 7:26 
Questionhow to add component???? Pin
don7cry24-Jul-03 0:46
don7cry24-Jul-03 0:46 
Generalfunction parameter with default value Pin
zecodela23-Jul-03 23:17
zecodela23-Jul-03 23:17 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.