DataSet type conflict

  • Thread starter Thread starter Steve Hiemstra
  • Start date Start date
S

Steve Hiemstra

Hi All,

I'm loading a DataSet through an exposed method of a Web Service (just
ignore the 'ominous' feeling, it's not that complex). I created a 'typed'
DataSet to put the data into, but I get the following compile error:

Cannot implicitly convert type 'System.Data.DataSet' to
'MyApp.MyTypedDataSet'

Here's the code:

private MyApp.MyTypedDataSet MyTypedDataSet;

MyTypedDataSet = Globals.Server.GetMyDataSet(-1);

Obviously GetMyDataSet( ) method returns a System.Data.DataSet type, and I
have a new type that is derived from it ('typed' DataSets derive from
System.Data.DataSet).

I tried 'casting':

MyTypedDataSet = (System.Data.DataSet) Globals.Server.GetMyDataSet(-1);

which compiled OK, but failed the same way during execution.

My question -

1) Can I 'expose' the 'System.Data.DataSet' buried in MyTypedDataSet so my
'typed' DataSet can accept the 'untyped' (System.Data.DataSet) data from the
Web Service?

-IF NOT-

2) What if I create a compatible (temporary) 'untyped' DataSet (a
System.Data.DataSet), and use that to catch the data from the Web Service
(just to get the data). How would I move the data (single table) from the
'untyped' DataSet into my 'typed' DataSet?

<PLEASE NOTE: I want the 'typed' DataSet so I can easily move the data into
my grid using a 'MyGrid.DataSource = MyTypedDataSet' assignment.>

Thanks in Advance,

SteveH
 
Back
Top