Asp net updating database from dataset

04 Mar

With the declarative, "code free" Data Source controls you can create a page that displays database data in under 15 seconds and without having to write a line of code. Both controls have virtually the same featureset, the only difference being how you specify the connection information.

In fact, the Access Data Source control is really superfluous since Microsoft Access databases can be accessed through the Sql Data Source control just as easily.

For example, in this mode, a connection could be established to read a chunk of data, the data could then be modified by the application as required.

A connection could then be reestablished only if and when the application writes data back to the database.

This decouples the working data set from the database.

This decoupled mode of working with data is supported by Connector/Net.

, the connection to the database was continually maintained, unless explicitly closed.

When I click “yes” it will bring up a data-design surface, and (if in a web project) automatically launch the “Create Table Adapter” wizard (if you are in a class library project you need to right click and choose “Add-The “Create Table Adapter” wizard will first prompt me for the database to use, and provide a list of all database connections currently registered in Visual Web Developer’s server-explorer window (note: you can also create new connections from this wizard if you want).

Here, the data can be viewed and changed before clicking an update button.

The update button then activates code to write changes back to the database. The application was built using the Microsoft Visual Studio to place and create the user interface controls, but the main code that uses the key classes described above is shown below, and is portable.

One of my goals over the next few weeks is to publish a number of quick tutorial postings that walkthrough implementing common data binding design patterns using ASP.

NET 2.0 (master details, filtering, sorting, paging, 2-way data-binding, editing, insertion, deletion, hierarchical data browsing, hierarchical drill-down, optimistic concurrency, etc, etc).