What is the basic difference between Dataset and Typed Dataset ? When would you use Typed dataset?

Typed DataSet is precompiled one

For Example in Normal DataSet this is how we use to get data.

ds.Tables["Employee"].Rows[0][0]

In typed DataSet usage is strongly bound.

ds.EmployeeTable.Rows[0].EmpIdColumn

Here every thing is typed no need to use index/name to identify table or column name.

Typed dataset yields less errors than mornal dataset in all the way.

Typed Dataset is faster than the normal dataset .


Typed DataSet

// C#
// This accesses the CustomerID column in the first row of
// the Customers table.
string s;
s = dsCustomersOrders1.Customers[0].CustomerID;
Untyped Datasets

// C#
string s = (string) dsCustomersOrders1.Tables["Customers"].Rows[0]["CustomerID"];

In addition to being easier to work with, the syntax for the typed dataset provides type checking at compile time, greatly reducing the possibility of errors in assigning values to dataset members

The problem of typed dataset is dynamic behaviour

No comments:

Post a Comment