DataSets in Child Forms

  • Thread starter Thread starter 2003et
  • Start date Start date
2

2003et

Couldn't I create DataSet in child forms????

Is there any solution for this???

Thanks in advance!

E.T.
 
2003et,

You can create a data set anywhere like this:

// Create a data set.
DataSet pobjDataSet = new DataSet();

But it wouldn't provide you with much off the bat. What are you trying
to do, or what are you finding you can't do?
 
Hi Nicholas,

I am writing what exactly my situation is:

I first create a form and set it as mdicontainer, then, create a second form
and set its mdiparent property to first form. Now I have two forms, parent
and child form.

Now, I can create dataset in parent form as you said:
DataSet ds = new DataSet();

But I cannot create the dataset in the second form...
DataSet ds2 = new DataSet();

It gives error:
F:\Ruhsat\M1.cs(2429): The type or namespace name 'DataSet' could not be
found (are you missing a using directive or an assembly reference?)

using System.Data.SqlClient; is there and I can create sqlcommand for
example, but I cannot create DataTable or DataSet.

Please try it, on VS.NET 2002

Thanks....



Nicholas Paldino said:
2003et,

You can create a data set anywhere like this:

// Create a data set.
DataSet pobjDataSet = new DataSet();

But it wouldn't provide you with much off the bat. What are you trying
to do, or what are you finding you can't do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

2003et said:
Couldn't I create DataSet in child forms????

Is there any solution for this???

Thanks in advance!

E.T.
 
2003et,

You will want to place the following at the head of your file:

using System.Data;

The DataSet class is located in the System.Data namespace, and this will
allow you to use the short notation for the DataSet class. Alternatively,
you can do this:

// Create the dataset.
System.Data.DataSet pobjDataSet = new System.Data.DataSet();

But you can see how this would get tedious.

Finally, make sure that you have a reference to System.Data.dll.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

2003et said:
Hi Nicholas,

I am writing what exactly my situation is:

I first create a form and set it as mdicontainer, then, create a second form
and set its mdiparent property to first form. Now I have two forms, parent
and child form.

Now, I can create dataset in parent form as you said:
DataSet ds = new DataSet();

But I cannot create the dataset in the second form...
DataSet ds2 = new DataSet();

It gives error:
F:\Ruhsat\M1.cs(2429): The type or namespace name 'DataSet' could not be
found (are you missing a using directive or an assembly reference?)

using System.Data.SqlClient; is there and I can create sqlcommand for
example, but I cannot create DataTable or DataSet.

Please try it, on VS.NET 2002

Thanks....



message news:[email protected]...
2003et,

You can create a data set anywhere like this:

// Create a data set.
DataSet pobjDataSet = new DataSet();

But it wouldn't provide you with much off the bat. What are you trying
to do, or what are you finding you can't do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

2003et said:
Couldn't I create DataSet in child forms????

Is there any solution for this???

Thanks in advance!

E.T.
 
Dear Nicholas,

Thank you so much!

I was about to get crazy!

Yes, you are right, I added using System.Data and it is ok now!

Thanks again!!!

Nicholas Paldino said:
2003et,

You will want to place the following at the head of your file:

using System.Data;

The DataSet class is located in the System.Data namespace, and this will
allow you to use the short notation for the DataSet class. Alternatively,
you can do this:

// Create the dataset.
System.Data.DataSet pobjDataSet = new System.Data.DataSet();

But you can see how this would get tedious.

Finally, make sure that you have a reference to System.Data.dll.

Hope this helps.


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

2003et said:
Hi Nicholas,

I am writing what exactly my situation is:

I first create a form and set it as mdicontainer, then, create a second form
and set its mdiparent property to first form. Now I have two forms, parent
and child form.

Now, I can create dataset in parent form as you said:
DataSet ds = new DataSet();

But I cannot create the dataset in the second form...
DataSet ds2 = new DataSet();

It gives error:
F:\Ruhsat\M1.cs(2429): The type or namespace name 'DataSet' could not be
found (are you missing a using directive or an assembly reference?)

using System.Data.SqlClient; is there and I can create sqlcommand for
example, but I cannot create DataTable or DataSet.

Please try it, on VS.NET 2002

Thanks....



message news:[email protected]...
2003et,

You can create a data set anywhere like this:

// Create a data set.
DataSet pobjDataSet = new DataSet();

But it wouldn't provide you with much off the bat. What are you trying
to do, or what are you finding you can't do?


--
- Nicholas Paldino [.NET/C# MVP]
- (e-mail address removed)

Couldn't I create DataSet in child forms????

Is there any solution for this???

Thanks in advance!

E.T.
 
Back
Top