This article is one in a series of articles on ASP. In addition to being used declaratively, the data source Web controls can also be accessed programmatically. This involved establishing a connection to the database, specifying the SQL command, and then executing the command. NET 2.0's data source controls greatly simplifies this process by encapsulating the data access pattern within a Web control construct.It is not a separate cache of data, so it does not maintain its own copy of data.But, it provides a more flexible way of working with the data that is stored in a Data Table, and in many times is actually used in place of a Data Table.In short, using the data source controls in this manner allows for data to be accessed programmatically with a single line of code.In this article we will examine how to use the Sql Data Source control to programmatically retrieve, insert, and delete data. The Sql Data Source and Access Data Source controls can be used to insert, update, delete, and retrieve data.There you will see an Insert Query option that, if clicked, displays the Command and Parameter Editor shown below. NET 2.0's data source controls are typically used declaratively, providing a code-free way to work with data.
Such an approach is useful when you need to work with data programmatically, but want to avoid having to write the boilerplate data access code.
As the code shows, it programmatically calls the Private Sub Programmatically Bind To Data Source Controls() 'Get the average price Data Reader Dim my Reader As IData Reader = CType(Avg Price Data Source. Of course, it's always possible to write code to connect to database, craft the table.