Can't create a new dataset from the toolbox

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

Guest

Can't create a new dataset from the toolbox.

In the past, on the advice of MVPs, I've created datasets by dragging the
dataset component from the datatab of the toolbox onto the form. The first
time it created dataset1, a dataset that did not exist before.

The second time it created a dataset2.

Today I dragged a dataset on a new form. It only offered current datasets,
not a default of a new dataset. When I typed in tfsNet2.dataset3 and clicked
OK, I got an error message

Visual Studio cannot create an instance of TFSMet2.Dataset3.
Confirm the class name is a valid dataset class.

What happened? Please help.

Dennis
 
Dennis,

You can look in your code if a dataset3 exist that is often orphaned.

As well you can open the solution explorer if you see if there already is a
dataset3.xsd which will not be romoved when you delete a previous made
dataset.

Just some ideas

Cor
 
I forgot to add that dataset1 and dataset2 do not appear in the designer. I
can't remember how I did this.

Dennis
 
hanks Cor,

But I didn't make myself understood. When I dragged the dataset component
for the toolbox originally, the designer offered a name that didn't
previously exist. The first time it offered dataset1, the second time
dataset2.

Now it only offers a combobox of existing datasets, and I don't see anyway
of choosing a different name. Every name I try brings forth the same error
message. If I change the name to fo9rosdflsdf, it'll give me the same
message.

Dennis
 
Dennis,

Did you try it with a clean project to see if it is in your project or
another errror?

Cor
 
Hi Dennis,

First of all, I would like to confirm my understanding of your issue. From
your description, I understand that you need to add a DataSet instance to
the current form. If there is any misunderstanding, please feel free to let
me know.

As far as I know, there are 2 kinds of DataSet we can add from the toolbox,
typed DataSet and untyped DataSet. When trying to add a typed DataSet
instance, the schema must be available in the project. That means we have
to create the DataSet3.xsd file first in Solution Explorer.

I think maybe you have created the DataSet from a DataAdapter. When you
have created a DataAdapter in winform designer, you can right click on that
DataAdapter and select Generate DataSet. It will help you to create the
DataSet xsd file and can generate an instance for that typed DataSet at the
same time.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Hi Kevin,

I want to add a typed dataset. You gave me an example of that once. I
don't remember any instructions for creating the xsd file first. Can you
tell me how to do that?

Thank you.

Dennis

I was trying to create
 
Hi Dennis,

There are 2 ways to achieve that.

1. If you already have a DataAapter created to fill that DataSet, you can
right click the DataAdapter on the designer and select Generate DataSet
from the popup menu. If you check Add this dataset to the designer, not
only the xsd file is generated, the DataSet is also instantiated.

2. If you don't have a DataAdapter created according to the DataSet, you
have to do the following. Right click on the project in the solution
explorer. Select Add/ Add New Item. Add a DataSet. In the DataSet, create
the schema. You can navigate in the Server Explorer and drag drop tables
from SQL servers directly. When the schema is created, go back to the
windows form designer and add DataSet from the toolbox. The created schema
for example, Dataset1 is in the combobox. You can select that and an
instance of DataSet1 is created.

HTH.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
You're welcome, Dennis.

Thanks for sharing your experience with all the people here. If you have
any questions, please feel free to post them in the community.

Kevin Yu
=======
"This posting is provided "AS IS" with no warranties, and confers no
rights."
 
Back
Top