C# – Strongly Typed DataSets and System.Data.DataRowBuilder

c++strongly-typed-dataset

I am converting some old V1.1 VB code. It uses a Strongly typed dataset. Then the person was able to do things like:

Dim myDs As NewDataSet = New NewDataSet
Dim myMbrIfcReqRow As NewDataSet.MbrIfcReqRow

I generated the same Strongly Typed DataSet in C# with xsd.exe. But when I try these same statements:

NewDataSet myDs = new NewDataSet();
NewDataSet.MbrIfcReqRow myMbrIfcReqRow = new NewDataSet.MbrIfcReqRow();

It says that "MbrIfcReqRow has 1 parameter but is invoked with 0 aruements." It is indeed. It has a parameter System.DataRowBilder. What do I do with that. it is in the generated code:

internal MbrIfcReqRow(global::System.Data.DataRowBuilder rb) : 
                base(rb) {
            this.tableMbrIfcReq = ((MbrIfcReqDataTable)(this.Table));

If I have to override the constructor how and where do I do it?

Best Solution

DataRow objects must always be associated with a DataTable; you cannot use that constructor directly.

Instead, call the generated yourTable.NewMbrIfcReqRow() method.