Typed DataSet from existing DataSet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I am working in C# creating a Windows Forms application. I have a dataset
from an Oracle database that I want to change to a typed dataset. Can this
be done once a dataset that is not typed has been returned from the database?
 
I do not think so.

Typed datasets is actually implemented using special classes generated
by Visual Studio.NET. Typed datasets must be created at design time.



Charles Zhang
http://www.speedydb.com (SpeedyDB ADO.NET Provider is the fastest, most
secure ADO.NET Provider over Wide Area Network)
 
I know that some people who use n-tier architecture do this. They create
the typed dataset using a stored procedure, then use that in their UI. They
read the table with the stored procedure, pass it back to the UI, and then
cast it to the strong typed dataset. It only works if the structures match
exactly.

Robin S.
 
Use dsStrong.Merge() and pass in your untyped dataset. As Robin indicated,
your untyped structure must match exactly in order to pull this off. You
might also consider merging individual datatables into the strongly-typed
dataset.
 
Yep, this is the way. As a last resort you might opt for "manual" copying of
each row
There might be another trick you might try. Try WriteXml method on untyped
one (to save it to a stream), transform xml to match the target dataset
(XSLT perhaps) and then ReadXml on typed one.

--
Miha Markic [MVP C#, INETA Country Leader for Slovenia]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

Earl said:
Use dsStrong.Merge() and pass in your untyped dataset. As Robin indicated,
your untyped structure must match exactly in order to pull this off. You
might also consider merging individual datatables into the strongly-typed
dataset.
 
Robert,

Your typed dataset in windows form format is a piece of to build code.
(And use that builded).

The code to build you can get by writing your XML to disk by using WriteXML.

Open that in your IDE as new item and save it than again by generating
Dataset.

Cor
 
Back
Top