"has no constructor defined"?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am using C# 2.0 (Visual Studio 2005 Beta)

I create a xsd by drag-drop a SQL table into a Dataset designer, which is in
turn compled by the MSDataSetGenerator to create a strong typed dataset
object. (The "usual" way, nothing special). It has created a few classes,
lets say

- MyDataSet
- MyDataSet.MyDataSetDataTable
- MyDataSet.MyDataSetDataRow
......

I then try to create a subclass by inherit from MyDataSet.MyDataSetDataRow:

public class myrow : MyDataSet.MyDataSetDataRow
{
}

The compiler complains"

The type 'MyDataSet.MyDataSetDataRow' has no constructor defined.

What's wrong?
 
Hi Xing Zhou,

I'm guessing that MyDataSetDataRow does not have an empty constructor but
only and overloaded one. When inheriting from this class you need to
implement the same constructor since your default empty constructor tries
to call the equivalent parent empty constructor, which does not exist.

Create a constructor in myrow with the same signature as MyDataSetDataRow
uses.
 
Thanks.

Yes, the MyDataSetDataRow only defined a non-default constructor. However
that constructor has an "internal" modifier! Therefore it is inaccessible
from outside as well.

Any more suggesion/thoughts?
 
Thanks. You are right that the MyDataSetDataRow class only defined a
non-default constructor which is defined as internal.

However even if I create a constructor in myrow class with the same
parameter signature, I still have the same compile error.
 
Back
Top