Add Row to Dataset Table /DataTable

DataSet dsFields = new DataSet();

string strQry = @” SELECT * FROM XYZ”;

// Settings.ConnectionString is where the Connection String is stored.

dsFields = OracleHelper.ExecuteDataset(Settings.ConnectionString, CommandType.Text, strQry);

DataRow newRow = dsFields.Tables[0].NewRow();

// Here I am adding only one column for presentation purpose.

// You can add columns as per your requirments.

newRow [“ColumnName”] = “ColumnName”;

newRow [“ColumnValue”] = “ColumnValue”;

// Adding row to Dataset-Table

dsFields.Tables[0].Rows.Add(newRow);

We can do similar way for DataTable also just replace dsFields.Tables[0] with your DataTable Name

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s