473,320 Members | 1,861 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,320 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?


Nov 16 '05 #1
3 1728
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
Nov 16 '05 #2
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
Nov 16 '05 #3
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?

Nov 16 '05 #4

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...
10
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...
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() {...
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...
8
by: mohammaditraders | last post by:
#include <iostream.h> #include <stdlib.h> #include <conio.h> #include <string.h> class Matrix { private : int numRows, numCols ; int elements ;
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.