2

SharePoint で 2 つのリストを作成しました。

  • 列を持つ 顧客:
    • ID
    • 名前
    • 住所
  • 次の列を持つ 製品:
    • ID
    • customer_id (ルックアップ)
    • 商品名

VS2010 の Web パーツを使用して、 DataGridViewで各顧客に属しているすべての製品の詳細を表示したいと考えています。

4

1 に答える 1

0

Camelot .NET Connector for SharePoint の新しい結合機能については、http://www.bendsoft.com/home/をご覧ください。

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 に答える