Friday, April 28, 2006

Difference between SqlDataSource and ObjectDataSource

Following is a difference between SqlDataSource and ObjectDataSource:
1. SqlDataSource is two-tier in nature where as ObjectDataSource supports three-tier architecture.
2. SqlDataSource requires very small amount of coding to connect with database. For ObjectDataSource more coding is required to build data access class.
3. SqlDataSource not support full encapsulation. ObjectDataSource supports full encapsulation.
4. SqlDataSource requires complete connection string to connect with database. ObjectDataSource exposes TypeName attribute that is a name of middle layer class may used to perform database related operations. Data access class must be placed in App_Code directory.
5. Caching is same for both controls but ObjectDataSource control fires NotSupported exception if return type of SelectMethod is other than DataSet.

Visitor Count: