To see the SqlDataSource in action, let's take a look at the Orders_SDS.aspx page (see Figure 4).
为了查看SqlDataSource是如何操作的,让我们先观察一下Orders_SDS . aspx页(参见图4)。
There is a DropDownList control that is bound to a SqlDataSource source control the retrieves a list of customers from the Northwind database.
有一个DropDownList 控件,它绑定到一个从Northwind 数据库中检索客户列表的SqlDataSource源控件。
The code in Figure 5, taken from Orders_SDS.aspx (which is available in the download), shows the two SqlDataSource controls and the DropDownList.
图5中的代码(摘自orders_sds . aspx—它可在下载中得到)显示了两个SqlDataSource控件和这个DropDownList。
Now that I've finished the overview, I will compare and contrast the retrieval and modification of data using both the SqlDataSource and the ObjectDataSource.
既然我已经完成了概述,那么我将对使用SqlDataSource和ObjectDataSource来检索和修改数据进行一下对比。
To add the SqlDataSource to the designer, open the Data section in the toolbox window, as shown in Figure 5, and drag the SqlDataSource onto the open designer.
要将SqlDataSource添加到设计程序,在toolbox窗口中打开Data部分,如图5所示,并将SqlDataSource拖拽到打开的设计程序中。
When loading an ASP.NET page that contains a data-bound control linked to a SqlDataSource, the SqlDataSource communicates directly with an underlying database.
当加载包含链接到SqlDataSource的数据绑定控件的ASP.NET页时,SqlDataSource直接与基础数据库进行通信。
In addition, in ASP.NET 2.0 the SQLDataSource control may optionally establish an automatic dependency with the database so that any change is promptly detected.
此外,在ASP.NET 2.0中,SQLDataSource控件可能选择性地建立与数据库的自动依赖关系,以便立即检测到数据变更。
In addition, in ASP.NET 2.0 the SQLDataSource control may optionally establish an automatic dependency with the database so that any change is promptly detected.
此外,在ASP.NET 2.0中,SQLDataSource控件可能选择性地建立与数据库的自动依赖关系,以便立即检测到数据变更。
应用推荐