convert untyped datatable/dataset into strongly typed

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
 
M

Miha Markic [MVP C#]

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top