Click here to Skip to main content
14,739,187 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I created tempory DataTable that is isolated/disconnected to DatatBase, and then add a new Row to the table using the piece of code below. However, through debugging view on the datatable, no values is stored in the new row. How can this problem be fixed? Thanks.
DataTable dt = (DataTable)Session["dt_HPosition_Temp"];
DataRow dRow = SetHPosition(dt.NewRow());  // this set the row w/ values
dt.Rows.Add();
dt.AcceptChanges();
Posted

1 solution

Hi,

Oops, you forgot to add the new row to your datatable!

Change:
dt.Rows.Add();


To:
dt.Rows.Add(dRow);


... hope it helps.
   
Comments
s yu 17-Sep-15 12:01pm
   
Wonderful! Thanks.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900