Accessing and Updating Data in ASP.NET 2.0: Programmatically Accessing Data using the Data Source Controls

Posted by: 4GuysFromRolla.com Headlines, on 11 Apr 2007 | View original | Bookmarked: 0 time(s)

A Multipart Series on ASP.NET 2.0's Data Source Controls
ASP.NET 2.0 introduced a number of new Web controls designed for accessing and modifying data. These controls allow page developers to declaratively access and modify data without writing any code to perform the data access. This article is one in a series of articles on ASP.NET 2.0's new data source controls.

  • Data Source Control Basics - explores the concepts and advantages of data source controls, and compares their usage in ASP.NET 2.0 to data access techniques in ASP.NET 1.x.
  • Accessing Database Data - shows how to use the SqlDataSource and AccessDataSource controls to query data from a relational database.
  • Filtering Database Data with Parameters - learn how to retrieve just a subset of database data based on hard-coded values and values from the querystring, other Web controls on the page, session variables, and so on.
  • Retrieving XML Data with XmlDataSource Control - see how to retrieve both remote and local XML data and display it in a data Web control.
  • Creating Custom Parameter Controls - learn how to create your own custom, declarative Parameter controls for use in the data source controls' parameters collections.
  • Examining the Data Source Control's Events - explore the events raised during a data source control's lifecycle.
  • Declaratively Caching Data - learn how to cache data to the data cache simply by setting a couple of data source control properties.
  • Programmatically Accessing Data using the Data Source Controls - programmatically retrieve, insert, delete, and update data using the SqlDataSource and AccessDataSource controls.
  • (Subscribe to this Article Series! )

    Working with data in ASP.NET version 1.x required writing data access code. This involved establishing a connection to the database, specifying the SQL command, and then executing the command. ASP.NET 2.0's data source controls greatly simplifies this process by encapsulating the data access pattern within a Web control construct. As such, data can be retrieved or modified and bound to a Web control without writing a single line of code. We explored the essentials of declarative data binding earlier in this article series in the Data Source Control Basics and Accessing Database Data articles.

    In addition to being used declaratively, the data source Web controls can also be accessed programmatically. It is possible to add a SqlDataSource or AccessDataSource control to a web page, specify SELECT, INSERT, UPDATE, or DELETE queries, and then to programmatically execute one of the control's SQL commands. 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. 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 SqlDataSource control to programmatically retrieve, insert, and delete data. Read on to learn more!
    Read More >

    Advertisement
    Free Agile Project Management Tool from Telerik
    TeamPulse Community Edition helps your team effectively capture requirements, manage project plans, assign and track work, and most importantly, be continually connected with each other.
    Category: ASP.NET | Other Posts: View all posts by this blogger | Report as irrelevant | View bloggers stats | Views: 897 | Hits: 71

    Similar Posts

    • Data-binding Telerik CoverFlow for Silverlight + some Routed Commands goodness more
    • Introducing Versatile DataSources more
    • How to display data from different tables using one data source more
    • An alternative to Crystal more
    • Business Apps Example for Silverlight 3 RTM and .NET RIA Services July Update: Part 19: ASP.NET Dynamic Data more
    • Using Microsoft's Chart Controls In An ASP.NET Application: Plotting Chart Data more
    • Silverlight Release History : Q2 2009 (version 2009.2.701) more
    • WPF Release History : Q2 2009 (version 2009.2.701) more
    • Improving Dynamic Data with Peter's Data Entry Suite more
    • Better XAML By Farr: WPF Line of Business Seminar more

    News Categories

    .NET | Agile | Ajax | Architecture | ASP.NET | BizTalk | C# | Certification | Data | DataGrid | DataSet | Debugger | DotNetNuke | Events | GridView | IIS | Indigo | JavaScript | Mobile | Mono | Patterns and Practices | Performance | Podcast | Refactor | Regex | Security | Sharepoint | Silverlight | Smart Client Applications | Software | SQL | VB.NET | Visual Studio | W3 | WCF | WinFx | WPF | WSE | XAML | XLinq | XML | XSD