SPListItemCollection.GetDataTable 方法 (Microsoft.SharePoint)

SPListItemCollection.GetDataTable 方法 (Microsoft.SharePoint)

                Windows SharePoint Services 3                 
 
                    Returns the collection of list items as a data table.

 

命名空间: Microsoft.SharePoint 程序集: Microsoft.SharePoint (在 microsoft.sharepoint.dll 中)
语法
 

public DataTable GetDataTable ()

 

 

返回值

A System.Data.DataTable object that contains the list items.
示例
 

The following code example uses the GetDataTable method to display items in a DataGrid control.

The example assumes the existence of an .aspx page that contains a DataGrid control.

SPWeb oWebsite = SPContext.Current.Web;
SPList oList = oWebsite.Lists["List_Name"];
SPListItemCollection collListItems = oList.Items;

DataGrid1.DataSource = collListItems.GetDataTable();
DataGrid1.DataBind();
posted @ 2017-09-10 17:48  sky20080101  阅读(149)  评论(0)    收藏  举报