2012-06-21 38 views
2

我創建2列出了在SharePoint:具有列如何使用VS 2010中的webpart加入SharePoint列表?

  • 客戶
    • ID
    • 地址
  • 產品具有列:
    • ID
    • CUSTOMER_ID(查找)
    • 產品名稱

我要顯示所有產品的詳細使用VS2010 Web部件屬於每一位客戶DataGridView

+0

我只是想爲了詳細給出這個問題,觀衆不理解我之前提交的問題。 – sujithtm

+1

如果您想更改某些內容,則無需發佈新問題 - **您可以編輯您發佈的每個問題**以改進它並添加必要的詳細信息。 –

+0

好的..我是堆棧溢出的新用戶,這就是爲什麼.. 謝謝 – sujithtm

回答

0

看一看在SharePoint中柯萊特.NET連接器新加入的功能,在發現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/

相關問題