Add Rows to a DataTable

To add new records into a dataset, a new data row must be created and added to the DataRow collection (Rows) of a DataTable in the dataset. The following procedures show how to create a new row and insert it into a DataTable. Examples are provided for both typed and untyped datasets.

I created this Dataset (view picture).


dsOperation dt = new dsOperation(); 
DataRow opRow = dt.Tables["Operations"].NewRow(); 
opRow["Group"] = "FirstGroup"; 
opRow["SubGroup"] = "SecondGroup"; 
opRow["Debit"] = 0; 
opRow["Credit"] = 10; 

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.