Click here to Skip to main content
16,005,181 members
Home / Discussions / C#
   

C#

 
GeneralRe: ToolBar flat style Pin
araku19-Dec-03 5:01
araku19-Dec-03 5:01 
GeneralCustom Exception Pin
Member 33502218-Dec-03 18:37
Member 33502218-Dec-03 18:37 
GeneralRe: Custom Exception Pin
Heath Stewart19-Dec-03 3:20
protectorHeath Stewart19-Dec-03 3:20 
GeneralChanging NTFS Directory Security Pin
mpemberton18-Dec-03 16:29
mpemberton18-Dec-03 16:29 
GeneralPower about Uninteruptable Power Supply events Pin
frank2118-Dec-03 12:23
frank2118-Dec-03 12:23 
GeneralRe: Power about Uninteruptable Power Supply events Pin
J. Dunlap18-Dec-03 13:02
J. Dunlap18-Dec-03 13:02 
GeneralRe: Power about Uninteruptable Power Supply events Pin
Kentamanos18-Dec-03 13:27
Kentamanos18-Dec-03 13:27 
GeneralAdding DataRow to DataTable Pin
zuhx18-Dec-03 11:35
zuhx18-Dec-03 11:35 
I am trying to add an arraylist to a datatable. The ArrayList contains a struct and the the struct basically holds several object variables. I use a foreach statement to loop through the arraylist and add the data to a datarow then add the datarow to a datatable. However, when I try to add the second datarow I get an error message saying 'This row already belongs to this table'. Even though I know the data has changed the it is a completely different row. I am including my code snippet, any suggestions is appreciated:

r = DataSet.Tables["TradeOrderFills"].NewRow();
theData = (ArrayList) oFills.GetByIndex(0);
Console.WriteLine("theData count "+theData.Count);
foreach(TradeData td in theData)
{
Console.WriteLine("Adding Row to DataTable");
Console.WriteLine(td.ticker);
r["preTicker"] = (string)td.ticker;
Console.WriteLine("column value "+r["preTicker"]);
Console.WriteLine(td.transactionType);
r["preTransType"] = (string)td.transactionType;
Console.WriteLine("column value "+r["preTransType"]);
r["preOrderTime"] = (string)td.orderTime;
r["prePrice"] = Convert.ToSingle(td.price);
r["preQ"] = Convert.ToSingle(td.fillQ);
r["preAccount"] = (string)td.account;
r["preBroker"] = (string)td.broker;
r["preStatus"] = (string)td.status;
DataSet.Tables["TradeOrderFills"].Rows.Add(r); //THIS IS WHERE THE ERROR OCCURS ON THE 2nd ITERATION
Console.WriteLine("Number of Rows "+DataSet.Tables["TradeOrderFills"].Rows.Count);
}
GeneralRe: Adding DataRow to DataTable Pin
Colin Angus Mackay18-Dec-03 15:06
Colin Angus Mackay18-Dec-03 15:06 
QuestionHow to create a new GUID? Pin
Larry Antram18-Dec-03 11:21
Larry Antram18-Dec-03 11:21 
AnswerRe: How to create a new GUID? Pin
Colin Angus Mackay18-Dec-03 11:28
Colin Angus Mackay18-Dec-03 11:28 
GeneralRe: How to create a new GUID? Pin
Larry Antram18-Dec-03 11:31
Larry Antram18-Dec-03 11:31 
GeneralDynamic configuration file Pin
Le centriste18-Dec-03 8:15
Le centriste18-Dec-03 8:15 
GeneralRe: Dynamic configuration file Pin
Not Active18-Dec-03 8:51
mentorNot Active18-Dec-03 8:51 
GeneralRe: Dynamic configuration file Pin
Heath Stewart18-Dec-03 9:43
protectorHeath Stewart18-Dec-03 9:43 
GeneralAcceptButton & Show() Pin
Arun Bhalla18-Dec-03 7:55
Arun Bhalla18-Dec-03 7:55 
GeneralRe: AcceptButton & Show() Pin
Mike Ellison18-Dec-03 8:52
Mike Ellison18-Dec-03 8:52 
GeneralRe: AcceptButton & Show() Pin
Member 26118818-Dec-03 22:16
Member 26118818-Dec-03 22:16 
GeneralClosing a blocked thread Pin
Guinness4Strength18-Dec-03 5:34
Guinness4Strength18-Dec-03 5:34 
GeneralRe: Closing a blocked thread Pin
Kentamanos18-Dec-03 6:12
Kentamanos18-Dec-03 6:12 
GeneralC# Windows Service Pin
frank2118-Dec-03 4:26
frank2118-Dec-03 4:26 
GeneralRe: C# Windows Service Pin
Jon Newman18-Dec-03 4:32
Jon Newman18-Dec-03 4:32 
GeneralRe: C# Windows Service Pin
Heath Stewart18-Dec-03 9:39
protectorHeath Stewart18-Dec-03 9:39 
GeneralXML Append serialized object to existing xml-file Pin
Mr. Labenche18-Dec-03 3:49
Mr. Labenche18-Dec-03 3:49 
GeneralRe: XML Append serialized object to existing xml-file Pin
Heath Stewart18-Dec-03 9:36
protectorHeath Stewart18-Dec-03 9:36 

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.