difference between typed dataset and dataset ?

G

Guest

hi ,
I want to know what the difference between a typed and untyped dataset is?
suppose i use the generate dataset option in VS.NET data menu to build a
dataset and then fill it using a data-adapter will it be a typed dataset? If
not , how can i make a typed dataset using the GUI?
Thanks
Shikher
 
W

W.G. Ryan eMVP

You can use the drag feature from Server Explorer, run xsd.exe from the
visual stuido command prompt, or Add New Item and add a Typed Dataset from
there.

Typed datasets offer <grin> strong typing so the fields are visible in
intellisense which makes them easier to work with at design time. There's
GUI Support so you don't have to write all of the code by hand which makes
development a lot quicker when used appropriately.

since they are typed you lose some flexibility - but if you're pretty sure
that the source data won't change they're probably the better choice in most
cases
 
D

Diego Deberdt

Are you familiar with the concept of 'inheritance'? A DataSet is a class
like any other class in the framework that you can customize by using
inheritance. A strongly-typed DataSet is a new class that inherits from
DataSet with the purpose of offering strongly typed access to the DataTables
inside it. A strongly-typed DataSet is only meaned to work with one
particular database schema.

There are several ways to create a strongly typed DataSet in VS. You can
easily find a description of the various ways on MSDN. Once you have created
your strongly-typed DataSet you will see an xml file in your project folder.
The XML file contains a description of the database schema for the
strongly-typed DataSet. Visual Studio uses the information in the XML file
to generate the code for your class. Once you have created a strongly-typed
dataset (you can see the xml file in your project), you can declare
variables and instantiate instances, just like you can do with any other
class.
 
G

Guest

thank you both ryan and diego for ur quick replies - basically what I infer
is that if I have a fixed setup ie a connection and an adapter already and I
generate the dataset on that then it will be a typed dataset on that adapter
but if I build a general dataset with no schema in it ; it will be an untyped
dataset ?
thanks
shikher
 
S

Sahil Malik

There are many differences between strongly typed ds and simple ds.

I have an entire chapter devoted in my book to this concept, so I cannot
possibly give you enough information on this in a paragraph or two.

You can create a strongly typed dataset from the GUI very easily.
a) By creating an XSD and then generating a dataset out of that
b) By using a proper data adapter and right click generate dataset.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 
C

Cor Ligthert

Mirage,

For me is the first line from Diego important in this.
A strongly typed dataset is a dataset that inherits from the base dataset.

It has nothing to do with schema's, those are in both, because schema's are
a part from the base dataset class.

The strongly typed dataset should make it your easier to use it and has the
possibility in it to do checkings in the created members and properties.

To show you a very small strongly typed dataset in VBNet
\\\
Class mydataset
inherits dataset
Public read only property TableOne as Datatable
Get
return me.tables(0)
End Get
end Class
///
You can use this as
\\\
dim myds as mydataset
dim mytable as datatable = myds.TableOne
///

This is very simple, to create more robust Strongly typed dataset VS Net has
a lot of tools in it where the XSD is a part from.

Just as addition,

Cor
 
G

Guest

Thank you all for your input
regards
mirage83

Sahil Malik said:
There are many differences between strongly typed ds and simple ds.

I have an entire chapter devoted in my book to this concept, so I cannot
possibly give you enough information on this in a paragraph or two.

You can create a strongly typed dataset from the GUI very easily.
a) By creating an XSD and then generating a dataset out of that
b) By using a proper data adapter and right click generate dataset.

- Sahil Malik
http://dotnetjunkies.com/weblog/sahilmalik
 

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