Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

doesn't exist in class or namespace error when creating a dataset 1

Status
Not open for further replies.

kisslogicgoodbye

Programmer
Mar 19, 2001
18
US
I created a dataadapter and connection. The .net interface says create dataset, I follow the wizard. I look at my code and all seems fine. I save and compile and I get the error:

C:\VISION\DataEntry\DataEntry.cs(48): The type or namespace name 'Dataset1' does not exist in the class or namespace 'DataEntry.DataEntry' (are you missing an assembly reference?)

My code:

using System;
using System.Drawing;
using System.Collections;
using System.ComponentModel;
using System.Windows.Forms;
using System.Data;
using System.ServiceProcess;

namespace DataEntry
{
public class DataEntry : System.Windows.Forms.Form {
private System.Windows.Forms.Panel MainMenu;
private System.Windows.Forms.Panel Checks;
private System.Windows.Forms.Panel ChecksForm;

private System.Data.SqlClient.SqlDataAdapter sqlDataAdapterVendorContractList;
private System.Data.SqlClient.SqlCommand sqlSelectCommandVendorContractList;
private System.Data.SqlClient.SqlConnection sqlConnectionVendorContractList;
private DataEntry.Dataset1 dataset11
 
can't you just declare it:
private Dataset dataset1
?
It's trying to look in the namespace DataEntry for type Dataset1, which isn't what you're trying to do.

Try the code I suggested and see if it works.
:)

Jack
 
private Dataset dataset1;

doesn't work either.

The type or namespace name 'Dataset1' does not exist in the class or namespace 'DataEntry.DataEntry' (are you missing an assembly reference?)

Do you know anything else I could try?

Thanks,
Jill

 
have you re-compiled the application after putting
private DataSet DataSet1;
in your code? Daren J. Lahey
Just another computer guy...
 
Just so I'm clear on something:

Are you trying to create a custom dataset object? If you were looking for the DataSet object reference native to .NET, you wouldn't be looking in DataEntry (which I'm guessing is your web form?)

Jack
 
I'm new at C# and .net - I'm not liking the gui interface for everything - I prefer just to type my own code, but anyway...

I originally had:
private System.Data.Dataset dataset1;

error received:
C:\VISION\DataEntry\DataEntry.cs(47): The type or namespace name 'Dataset' does not exist in the class or namespace 'System.Data' (are you missing an assembly reference?)

So I tried to use the Generate Dataset wizard and it put in the DataEntry.Dataset definition.
 
k, I don't use C# (vb man myself), but I'm guessing that the syntax should be similar. And if it is, then you DON'T NEED the System. part for declaring a dataset!

You should be able to to this (this is the vb syntax)

Dim objDS as new DataSet

so in C# I'm guessing its something like

Private DataSet DataSet1


Give it a shot, let me know how it goes.

Jack
 

private DataSet dataset1;

is correct in c#...

Daren J. Lahey
Just another computer guy...
 
That did it!!!

I'm coming from Java where everything is explicit so it didn't even occur to me to try that!!

Thanks,
Jill
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top