Wednesday, 26 June 2013

Difference between Dataset and Datatable

-> A DataTable is an in-memory representation of a single database table which has  collection of rows and columns where as
   A  DataSet is an in-memory representation of a database-like structure which has collection of  DataTables.

-> DataTable fetches only one TableRow at a time where as
   DataSet can fetch multiple TableRows at a time

->As DataTable is a single database table, so there is no DataRelation object in it where as
  In DataSet, DataTable objects  can be related to each other with DataRelation objects.

->In DataTable, there is no UniqueConstraint and ForeignKeyConstraint objects available where as
  In DataSet, data integrity is enforced by  using the UniqueConstraint and ForeignKeyConstraint objects.

->In DataTable,  DataSource cannot be  serialized where as
  DataSet is serialized DataSource .That is why web services can always returns DataSet as the result but not the DataTables.

No comments:

Post a Comment