convert untyped datatable/dataset into strongly typed

  • Thread starter Thread starter Somebody_Out_There
  • Start date Start date
S

Somebody_Out_There

Hello,
I am trying to create a strongly typed datatable/dataset from an untyped
dataset or datatable returned from a stored proc.

The structure of the table cannot be static since the results are
dynamic which means that I am right now creating the schema/structure of
the datatable from a datareader using reader.GetSchemaTable() and then
looping thru the reader to populate values.

Is there any other efficient way of achieving this? GetSchemaTable() is
another round-trip to the DB that I am trying to avoid.

Thanks in advance
 
Hi Somebody,

Since your stored proc returns you various schemas there is no way you could
do it fully automatically.
You'll have to create a strong typed dataset per result at design time.
BTW, you don't need GetSchemaTable to retrieve data.
 
Back
Top