PC Review


Reply
Thread Tools Rate Thread

Generated Code Won't Compile

 
 
Curt Emich
Guest
Posts: n/a
 
      24th Apr 2004
I'm trying to create a dataset. I start by creating a connection. Then I
create and configure a data adapter. Finally, I select "generate dataset"
after right-clicking on the data adapter. It creates a dataset and puts it
under the form, just like the connection and the adapter.

When I try to compile the code GENERTED BY THE IDE, it bombs. Here's the
code:

protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;

protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;

protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;

protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;

protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;

protected TrainOfThought.DataSet1 dataSet11;



It bombs on the last line. It says that the type or namespace "DataSet1"
does not exist. I never said it did. Does anyone know why .NET would bomb
on its own code? What can I do to fix this?




 
Reply With Quote
 
 
 
 
Frans Bouma [C# MVP]
Guest
Posts: n/a
 
      24th Apr 2004
Curt Emich wrote:

> I'm trying to create a dataset. I start by creating a connection. Then I
> create and configure a data adapter. Finally, I select "generate dataset"
> after right-clicking on the data adapter. It creates a dataset and puts it
> under the form, just like the connection and the adapter.
>
> When I try to compile the code GENERTED BY THE IDE, it bombs. Here's the
> code:
>
> protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
>
> protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
>
> protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
>
> protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
>
> protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
>
> protected TrainOfThought.DataSet1 dataSet11;
>
>
>
> It bombs on the last line. It says that the type or namespace "DataSet1"
> does not exist. I never said it did. Does anyone know why .NET would bomb
> on its own code? What can I do to fix this?


Did you add the generated dataset to your project?

Frans.


--
Get LLBLGen Pro, the new O/R mapper for .NET: http://www.llblgen.com
My .NET Blog: http://weblogs.asp.net/fbouma
Microsoft C# MVP
 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      24th Apr 2004
Hi Curt,

I am not sure what it does in C# however sometimes in VB the code stays in
the designer when you make some corrections afterwards .

Did you try it with a new project again?.

Cor


 
Reply With Quote
 
William Ryan eMVP
Guest
Posts: n/a
 
      24th Apr 2004
Hi Curt:

A few questions:

First, if you look in the solution explorer, do you see a xsd that matches
the one you just made? I'm just wondering b/c I've repeated the steps you
mentioned and it worked by default. However, this is the actual reference
line it generated:
<<protected TrainOfThought.DataSet1 dataSet11;>>
Basically the same as yours other than the form name and the access
modifier. That's not surprising. However, my project has the DataSet1.xsd.
However, if I right click on DataSet1.xsd in the solution explorer and
choose Exclude from Project.. I still have my declaration as above but I
know get this exception when I try to compile:
<<C:\WindowsApplication5\Form1.cs(33): The type or namespace name 'DataSet1'
does not exist in the class or namespace 'WindowsApplication5' (are you
missing an assembly reference?)>> Which is the same thing you are having.

Just to see if this may have happened accidentally , select the Project menu
item and then check Show All Files. See if it doesn't appear afterward (it
so, it will probably have a blank white icon instead of your typical form
icons or class icons.

2) I'm not sure what options you chose when you generated the dataset. You
have a choice where to gen the new dataset, in a new one or an existing one.
You'll should have a choice of each table that you've created a dataadapter
for that has a Select Command. Finally, there's an option for adding the
dataset to the designer. I'm just wondering which options you chose (New
vs. Existing, and did you unchoose the Add DataSet to designer option?

I think the most likely culprit is that the xsd somehow was excluded or
there was an error when generating it. As such, it's not visible to your
class so it's raising the error. If you choose Show all files and you see
it, then just include it in the project and it should be fine. If not, then
it must have either never been generated correctly or somehow got deleted.
IF that's the case, delete the line causing the exception and just start ove
r again with generating the dataset. It should be fine.

Finally, what do you mean by the comment "It says that the type or namespace
"DataSet1"
> does not exist. I never said it did. " when you say "I never said it

did"? That makes me think it was excluded or specifically you didn't chose
the add to designer option, but that's purely conjecture and that's why I
mention it. Since I think the most likely problem is the exlusion of the
file, that's probably what caused it if my guess is correct (but like I
said, it's just a guess that's why I ask).
Let me know and hopefully we can get to the bottom of it.

Cheers

Bill

"Curt Emich" <(E-Mail Removed)> wrote in message
news:ZK-dnYxaxOOIRhTdRVn-(E-Mail Removed)...
> I'm trying to create a dataset. I start by creating a connection. Then I
> create and configure a data adapter. Finally, I select "generate dataset"
> after right-clicking on the data adapter. It creates a dataset and puts

it
> under the form, just like the connection and the adapter.
>
> When I try to compile the code GENERTED BY THE IDE, it bombs. Here's the
> code:
>
> protected System.Data.OleDb.OleDbCommand oleDbSelectCommand1;
>
> protected System.Data.OleDb.OleDbCommand oleDbInsertCommand1;
>
> protected System.Data.OleDb.OleDbCommand oleDbUpdateCommand1;
>
> protected System.Data.OleDb.OleDbCommand oleDbDeleteCommand1;
>
> protected System.Data.OleDb.OleDbDataAdapter oleDbDataAdapter1;
>
> protected TrainOfThought.DataSet1 dataSet11;
>
>
>
> It bombs on the last line. It says that the type or namespace "DataSet1"
> does not exist. I never said it did. Does anyone know why .NET would

bomb
> on its own code? What can I do to fix this?
>
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Compile errors in .NET generated code for Web Services =?Utf-8?B?Q2hhbmRyZXNo?= Microsoft Dot NET Compact Framework 8 17th Jul 2012 08:24 AM
Designer generated code fails to compile Pat Moran Microsoft ADO .NET 3 14th Apr 2008 04:17 PM
W2K Error: "SVCHOST has generated errors...An error log is being generated" ? Al Dykes Windows XP General 1 14th May 2005 03:54 PM
The application, C:\WINDOWS\system32\lsass.exe, generated an application error The error occurred on 05/03/2004 @ 10:50:46.755 The exception generated was c0000005 at address 00900090 () =?Utf-8?B?cmljayBj?= Windows XP General 2 5th May 2004 03:36 AM
Generated Code Won't Compile Curt Emich Microsoft Dot NET 5 25th Apr 2004 07:14 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 11:57 PM.