473,385 Members | 1,875 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Generated Code Won't Compile

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?


Jul 21 '05 #1
10 1816
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
Jul 21 '05 #2
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
Jul 21 '05 #3
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
Jul 21 '05 #4
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
Jul 21 '05 #5
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" <ce****@comcast.net> wrote in message
news:ZK********************@comcast.com... 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?

Jul 21 '05 #6
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" <ce****@comcast.net> wrote in message
news:ZK********************@comcast.com... 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?

Jul 21 '05 #7
Those .xsd files were there, but they still didn't work. I manually
typed in a dataset, and it works fine. I just thought the IDE would be
more reliable. Thanks to everyone for your feedback.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #8
Those .xsd files were there, but they still didn't work. I manually
typed in a dataset, and it works fine. I just thought the IDE would be
more reliable. Thanks to everyone for your feedback.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Jul 21 '05 #9
It's pretty reliable but it's not infallible. There's a lot that can go
wrong. and considering the possibilities, it's impressive it works as well
as it does. I'm glad you got it fixed though.

Cheers,

Bill
"Curt Emich" <ce****@comcast.net> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
Those .xsd files were there, but they still didn't work. I manually
typed in a dataset, and it works fine. I just thought the IDE would be
more reliable. Thanks to everyone for your feedback.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #10
It's pretty reliable but it's not infallible. There's a lot that can go
wrong. and considering the possibilities, it's impressive it works as well
as it does. I'm glad you got it fixed though.

Cheers,

Bill
"Curt Emich" <ce****@comcast.net> wrote in message
news:e9**************@tk2msftngp13.phx.gbl...
Those .xsd files were there, but they still didn't work. I manually
typed in a dataset, and it works fine. I just thought the IDE would be
more reliable. Thanks to everyone for your feedback.

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Jul 21 '05 #11

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Irmen de Jong | last post by:
Hello, I don't understand why the following doesn't work. What I want to do is dynamically import some generated Python code and I'm doing this using compile and exec'ing it in the dict of a new...
6
by: Dave | last post by:
Hello all, Consider this function template definition: template<typename T> void foo(T) {} If foo is never called, this template will never be instantiated. Now consider this explicit...
1
by: Reader | last post by:
Hello, I would like to know if there is a way to cache the xmlserializer-generated temp files and have the program reuse these cached files upon new application instances. For example,...
5
by: n_o_s_p_a__m | last post by:
Can't compile. Does this mean that all functions that throw exceptions must be of return type void? examples: // won't compile: "not all code paths return a value" public override int Run() {...
3
by: Curt Emich | last post by:
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...
4
by: Jon Rista | last post by:
I have a project where I need to create a windows .exe by compiling code and linking in some resources. This program thats being generated is somewhat unconventional, and I'll explain how. I'm...
8
by: cd~ | last post by:
I can provide a test app, the news server won't allow me to post the files because they are too large (93KB and 1.2KB) I downloaded the ESRI ArcXml schema and generated the classes from the...
11
by: Jan | last post by:
I'm using the CSharpCodeProvider to buils some assemblies @ runtime which are never saved as files (cp.GenerateInMemory = true;). The generated assemblies are hierachically dependent on each other...
10
by: Sourcerer | last post by:
I wrote this very simple code in .NET VC++. I compiled it on my system, and tried to run it on my friend's computer (he doesn't have the compiler). We both have Windows XP Professional. I have .NET...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.