By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,008 Members | 2,963 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,008 IT Pros & Developers. It's quick & easy.

convert untyped datatable/dataset into strongly typed

P: n/a

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
Nov 16 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

--
Miha Markic [MVP C#] - RightHand .NET consulting & development
miha at rthand com
www.rthand.com

"Somebody_Out_There" <so**************@devdev.com> wrote in message
news:e4**************@TK2MSFTNGP09.phx.gbl...

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

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!

Nov 16 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.