DataSource controls in ASP. NET 2.0

Source: Internet
Author: User

ASP. NET 2.0 has made great improvements in the data connection. The newly added datasource control makes it easier to connect to the database, many of them can write SQL statements and connect to databases through wizard settings. There are 6 DataSource controls in ASP. NET 2.0:
Sqldatasource control-data source control used to connect to the SQL database
Accessdatasource control-data source control used to connect to the access Database
ObjectDataSource control-data source control used to connect custom objects
DataSetDataSource control ----- controls that use XML files as dataset and perform relevant Processing
XmlDataSource control ----- this control loads Xml files and binds them to datagrid, datalist, and other controls.
SiteMapDataSource control ----- this control loads a pre-defined site layout file and binds it to the treenode tree control or Sitemappath control to facilitate the creation of site page navigation.
 
This article focuses on the ObjectDataSource control, DataSetDataSource control, and XmlDataSource control. For more information about sqldatasource control, see use ASP. NET 2.0 GridView control, this article introduces the use of sqldatasource control, and accessdatasource control, similar to sqldatasource control, but the connected database is access.
ObjectDataSource Control
This control binds the objects created by the user to the data control, such as the datagrid and gridview. The following is an example. In visual studio 2005 beta 1, create a new site and add a new class named Products:
Imports Microsoft. VisualBasic
Imports System. Data
Imports System. Data. SqlClient
Public Class Products
Public Function getProducts () As DataSet
Dim conn As New SqlConnection ("Server = (local); Integrated Security = True; Database = Northwind; Persist
Security Info = True ")
Dim adapter As New SqlDataAdapter ("SELECT [ProductID], [ProductName], [SupplierID], [CategoryID],

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.