ASP.NET Tutorial/Data Binding/DataSource control

Материал из .Net Framework эксперт
Перейти к: навигация, поиск

You bind a DataBound control to a DataSource control.

   <source lang="csharp">

A DataSource control is used to represent a particular type of data. The ASP.NET 3.5 Framework includes the following six DataSource controls: SqlDataSource: SQL relational database, including Microsoft SQL Server, Oracle, or DB2. LinqDataSource: Represents a LINQ to SQL query. AccessDataSource: Represents data retrieved from a Microsoft Access database. ObjectDataSource: Represents data retrieved from a business object. XmlDataSource: Represents data retrieved from an XML document. SiteMapDataSource: Represents data retrieved from a Site Map Provider.

<%@ Page Language="C#" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" ""> <html xmlns="" > <head id="Head1" runat="server">

   <title>Bound GridView</title>

</head> <body>

   <form id="form1" runat="server">
       Runat="server" />
       ConnectionString="Data Source=.\SQLExpress;
           Integrated Security=True;User Instance=True"
       SelectCommand="SELECT * FROM Products"
       Runat="server" />

</body> </html></source>