How to generate DataSet code

R

RK Henry

Ok, I'm relatively new to C#. Most of my experience has been with C++
and Java.

I'm trying to create a Dataset for a web application using the Dataset
Designer in Visual Studio 2005. I've read the articles, followed the
tutorials, etc. According to all of them, all I have to do is use the
wizard or drag tables from the server view panel. Ok, that's easy. It
even figures out the relationships from the table keys. (For these
experiments, I'm using the Northwind sample database.) An XSD is
created, ok there too. Now how do I get it to create the .CS class
files that the articles all talk about?

There's a button on the Designer toolbar for which the tool tip says,
Generate Code, but it's greyed out. Is there no way to force
generation of classes?

Of what use is the XSD if there's no C# code to link into my
application? I hope I'm not expected to write all those wrapper
classes by hand.

RK Henry
 
N

Nicholas Paldino [.NET/C# MVP]

RK,

If you look in your project at the XSD with the "show all files" option
selected, you will be able to expand the XSD file. You should see a
..designer.cs file, which has the generated code. It's already there for
you.

Hope this helps.
 
R

RK Henry

RK,

If you look in your project at the XSD with the "show all files" option
selected, you will be able to expand the XSD file. You should see a
.designer.cs file, which has the generated code. It's already there for
you.

Hope this helps.

Ah, that's just it, I don't see a .designer.cs file. I look in the
project folder and I don't see it there either. Either VS is putting
it someplace completely unexpected or it's not generating it at all.

RK Henry
 
R

robert.henry

Microsoft Visual Studio 2005 8.0.50727.42

I've just used Windows Search of *.cs files on my drive. Of the 6500
files found, I found one called dataset1.xsd.72c3cc2a.cs in the Windows
\Microsoft.net\Framework\..\sources_App_Code folders. That's why I
couldn't see it. it's not in my project folder. It's not the behavior
I was expecting so that's what fooled me.

So how do I get it to load it in my project folder where I can use it
and how do I get it to name it something like what is described in the
documentation?

Also, the project I'm working on is a web application. I created it by
clicking "new..web site". When I added the dataset, it cautioned that
I needed to add those files to the App_code folder, and I accepted. I
notice that there's no "show all files" on this solution explorer like
there is when I'm working on a C# project. I wonder if that's also
related to why there's no dataset classes.

RK Henry

RK,

What version of VS are you using?

--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)




On Tue, 20 Mar 2007 19:23:32 -0400, "Nicholas Paldino [.NET/C# MVP]"
RK,
If you look in your project at the XSD with the "show all files"
option
selected, you will be able to expand the XSD file. You should see a
.designer.cs file, which has the generated code. It's already there for
you.
Hope this helps.
Ah, that's just it, I don't see a .designer.cs file. I look in the
project folder and I don't see it there either. Either VS is putting
it someplace completely unexpected or it's not generating it at all.
RK Henry- Hide quoted text -

- Show quoted text -
 
R

robert.henry

Addendum:

Ok. I've experimented with a pure C# application, as opposed to to the
ASP.NET application I was trying before. In a console C# application,
VS does indeed generate CS dataset classes in the project folder. In a
web application, it doesn't. That's different from what's in the
books, articles and tutorials I've been reading.

I notice that in a web application that there's no "Show All Files"
button on the solution explorer either.

RK Henry
 

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