SQLDataSource Vs ObjectDataSource
The ASP.Net SQLDataSource and ObjectDataSource are used to databind data bound controls such as the GridView. Their ease of use differs along with their flexibility and architectural strengths.
The SQLDataSource has a simple point and click interface which requires a minimal amount of code. It allows you to easily create Select, Insert, Update, and Delete commands that can be executed against a Sql Server data source. Paging is easily incorporated into the design.
The ease of use results in the user interface, business logic, and data layer co-existing within the form or control. Although this is not an optimum design, it is effective for single-tier applications. However, multi-tiered applications need not discount the SQLDataSource. It can still be effectively used for functionality such as admin table maintenance.
The ObjectDataSource uses custom objects. These can be class objects or DAL (Data Access Layer) objects. The use of class objects allows the application to be architected into a Business Layer/Database Layer structure, which is a best practices architecture. Paging can be incorporated into ObjectDataSources, but require additional coding.
Keep in mind that you don’t have to use a SQLDataSource or ObjectDataSource. You can also programmatically define a datasource and databind it to a data control.
|