2

我在 SharePoint 中创建了 2 个列表:

  • 具有以下列的客户
    • ID
    • 姓名
    • 地址
  • 具有以下列的产品
    • ID
    • customer_id(查找)
    • 产品名称

我想在 VS2010 中使用 Web 部件在DataGridView中显示属于每个客户的所有产品详细信息。

4

1 回答 1

0

查看位于http://www.bendsoft.com/home/的用于 SharePoint 的 Camelot .NET 连接器中的新连接功能

Thsi 将使您能够编写这样的查询

using (var connection = new SharePointConnection(connectionString))
{
    connection.Open();
    using (var command = new SharePointCommand(@"SELECT Customer.name AS Name
                , Customer.address AS Address
                , Customer.ID AS CustomerId
                , Product.ID AS ProductId
                , Product.customer_id AS ProductCustomerId
                , Product.productname AS ProductName
                FROM Customers
                INNER JOIN Log ON CustomerId = ProductCustomerId"
                , connection))
    {
        using (var reader = command.ExecuteReader())
        {
            while (reader.Read())
            {
                Console.WriteLine(reader["Name"].ToString().PadRight(30) + " : " + reader["Event"].ToString().PadRight(30) + " : " + reader["Created"].ToString());
            }
        }
    }
}

http://www.bendsoft.com/documentation/camelot-net-connector/latest/sql-statement-syntax/join/

于 2012-06-21T09:18:15.123 回答