Typed DataSet from existing DataSet

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?
 
C

Charles Zhang

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)
 
R

RobinS

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.
 
E

Earl

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.
 
M

Miha Markic

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.
 
C

Cor Ligthert [MVP]

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
 

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