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).

DataSet

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

By Enrico

My greatest passion is technology. I am interested in multiple fields and I have a lot of experience in software design and development. I started professional development when I was 6 years. Today I am a strong full-stack .NET developer (C#, Xamarin, Azure)

Leave a Reply

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