Adding a SQL Dataset and instant error

  • Thread starter Thread starter CaptainCaveman
  • Start date Start date
C

CaptainCaveman

Hi

I am adding a DataGridView to my application, and binding it to a table in
my SQL database.
As soon as the connection is complete I get a compilation error of

"The type name 'DataSet' does not ewxist in the type 'project.project'"

I have located this to the fact that the new entries are appearing in my
designer.cs file as 'new project.dataset'
If I remove the 'project' so that it appears as 'new dataset' then all is OK
(well, no compilation errors), but any time i modify anything to do with the
DataGridView the designer.cs file is modified and returned to the erorr
state.

Does anyone know what is causing this to happen?

Additionally, when I have managed to compile the app and get it running,
there is no auto update on the table, even though the update collection
settings are configured as part of the DataGridView, i.e. when viewing the
properties of the TableAdapter the UpdateCommand is populated. I cant help
but think that this is tied to the above problem.

Again, any help would save my sanity so please advise of suggestions.

BTW - I am completely new to this!!!!!!
 
morning;
Programatically it would be something like this

SqlConnection cn;
SqlCommand cmd;
SqlDataAdapter da;
DataSet ds;
DataTable tbl = null;



cn = new SqlConnection(your connection string);
cmd = new SqlCommand(your querry, cn);
cmd.CommandType = CommandType.Text;
cn.Open();
ds = new DataSet("myDataset");
tbl = new DataTable("myDataset");
da = new SqlDataAdapter(cmd);
da.Fill(ds, "myDataset");
cn.Close();


rafone
 
Hi

I am adding a DataGridView to my application, and binding it to a table in
my SQL database.
As soon as the connection is complete I get a compilation error of

"The type name 'DataSet' does not ewxist in the type 'project.project'"

I have located this to the fact that the new entries are appearing in my
designer.cs file as 'new project.dataset'
If I remove the 'project' so that it appears as 'new dataset' then all isOK
(well, no compilation errors), but any time i modify anything to do with the
DataGridView the designer.cs file is modified and returned to the erorr
state.

Does anyone know what is causing this to happen?

Additionally, when I have managed to compile the app and get it running,
there is no auto update on the table, even though the update collection
settings are configured as part of the DataGridView, i.e. when viewing the
properties of the TableAdapter the UpdateCommand is populated. I cant help
but think that this is tied to the above problem.

Again, any help would save my sanity so please advise of suggestions.

BTW - I am completely new to this!!!!!!

Can you post your code?
DataSet is defined in System.Data.

Make sure that yuo include a using System.Data in your source code
 
Hi Ignacio,

Thanks for your reply.
I have resolved the issue by renaming my form class from the namespace name
to a new name, i.e. instead of class and namespace being called MyProject my
namespace is now MyProject and my form class is now Project.

As I say, changing the name has resolved the issue, but that still doesnt
explain why the issue was present in the first place. After all, it is
hardly uncommon for Namespace names to also be the name of the primary
class.

Thanks for youi help

message
Hi

I am adding a DataGridView to my application, and binding it to a table in
my SQL database.
As soon as the connection is complete I get a compilation error of

"The type name 'DataSet' does not ewxist in the type 'project.project'"

I have located this to the fact that the new entries are appearing in my
designer.cs file as 'new project.dataset'
If I remove the 'project' so that it appears as 'new dataset' then all is
OK
(well, no compilation errors), but any time i modify anything to do with
the
DataGridView the designer.cs file is modified and returned to the erorr
state.

Does anyone know what is causing this to happen?

Additionally, when I have managed to compile the app and get it running,
there is no auto update on the table, even though the update collection
settings are configured as part of the DataGridView, i.e. when viewing the
properties of the TableAdapter the UpdateCommand is populated. I cant help
but think that this is tied to the above problem.

Again, any help would save my sanity so please advise of suggestions.

BTW - I am completely new to this!!!!!!

Can you post your code?
DataSet is defined in System.Data.

Make sure that yuo include a using System.Data in your source code
 
Back
Top