---
title: "DataRow constructor inaccessible when writing DataSet extension?"  
description: "DataRow constructor inaccessible when writing DataSet extension?"  
author: "Anonymous User"  
published: 2014-01-28  
updated: 2014-01-28  
canonical: https://www.mindstick.com/forum/1891/datarow-constructor-inaccessible-when-writing-dataset-extension  
category: "c#"  
tags: ["c#"]  
reading_time: 2 minutes  

---

# DataRow constructor inaccessible when writing DataSet extension?

I [am trying](https://answers.mindstick.com/qa/36834/which-two-programming-languages-should-i-master-in-if-i-am-trying-to-get-into-google-or-facebook) to write a couple of [extensions](https://www.mindstick.com/articles/12362/is-ajax-cart-extensions-necessary-for-e-commerce-websites) to [convert](https://www.mindstick.com/forum/2093/configurationmanager-appsettings-convert-n-to-n-why) UniDataSets and UniRecords to [DataSet](https://www.mindstick.com/articles/19/dataset) and DataRow but I get the following [error](https://yourviews.mindstick.com/view/88527/fixing-quickbooks-error-4120-reinstalling-vs-repairing) when I try to compile.

'[System](https://www.mindstick.com/articles/23411/the-most-effective-method-to-find-the-perfect-small-business-phone-system-for-your-business).Data.DataRow.DataRow(System.Data.DataRowBuilder)' is inaccessible due to its [protection](https://www.mindstick.com/blog/301143/how-to-wear-knee-braces-for-the-best-protection) level

Is there any way to [fix](https://yourviews.mindstick.com/view/80763/donald-trump-ki-jeet-fix-hai) this or should I abandon this [approach](https://www.mindstick.com/interview/985/what-are-the-approaches-that-you-will-follow-for-making-a-program-very-efficient) and come at it a different way?

```
    using System;               using System.Collections.Generic;    using System.Linq;    using System.Text;    using System.Threading.Tasks;    using System.Data;    using IBMU2.UODOTNET;    namespace Extentions    {        public static class UniDataExtentions        {            public static System.Data.DataSet ImportUniDataSet(this System.Data.DataSet dataSet, IBMU2.UODOTNET.UniDataSet uniDataSet)            {                foreach (UniRecord uniRecord in uniDataSet)                {                    DataRow dataRow = new DataRow();                    dataRow.ImportUniRecord(uniRecord);                    dataSet.Tables[0].ImportRow(dataRow);                }                return dataSet;            }            public static void ImportUniRecord(this System.Data.DataRow dataRow, IBMU2.UODOTNET.UniRecord uniRecord)            {                int fieldCount = uniRecord.Record.Dcount();                // ADD COLUMS                dataRow.Table.Columns.AddRange(new DataColumn[fieldCount]);                // ADD ROW                for (int x = 1; x < fieldCount; x++)                {                    string stringValue = uniRecord.Record.Extract(x).StringValue;                    dataRow[x] = stringValue;                }            }        }    }
```

## Replies

### Reply by Pravesh Singh

Hi Ashish,\

I tried a simpler approach, however it is for multiple rows and can be applied to a single row as well:

```
//Declare a variable for multiple rows DataRow[] rows = null;//get some data in a DataTable named table//Select specific data from DataTable named tablerows = table.Select("column = 'ColumnValue'");//Read the value in a variable from the rowstring ColumnValue = rows[0]["column"].ToString();
```

hope this helps..


---

Original Source: https://www.mindstick.com/forum/1891/datarow-constructor-inaccessible-when-writing-dataset-extension

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
