"has no constructor defined"?

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?
 
M

Morten Wennevik

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

Guest

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?
 
G

Guest

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top