2009-02-19 59 views
0

這是我的愛好,我有一個名爲Plantilla的類,它包含幾個允許在wpf中綁定gridview的屬性,所以這已經在工作,但用戶告訴我他們需要通過數據庫中的某個字段重新組合查詢,所以我準備這個片段:如何通過查詢讀取LINQ組?

var dsTemplates = (from t in db.PLANTILLAs 
            join q in db.EQUIPOs on t.codigoequipo equals q.codigoequipo 
            where t.codigoestudio.Substring(5, 1).Equals(codigoModalidad) 
            orderby t.tituloplantilla 
            group new Plantilla 
            { 
             codigoplantilla = t.codigoplantilla, 
             codigoequipo = t.codigoequipo, 
             nombreequipo = q.nombreequipo, 
             codigoestudio = t.codigoequipo, 
             conclusion = t.conclusion, 
             hallazgo = t.hallazgo, 
             nombreexamen = t.tituloplantilla, 
             tecnica = t.tecnica 
            } by t.codigoestudio 
       ).ToList(); 
       formTemplates.dlstPlantillas.ItemsSource = dsTemplates; 
       db.Connection.Close(); 

現在我的問題是我如何閱讀以下內容?在Hashtable中?我怎麼能把一個泛型轉換成一個Hashtable?因爲我現在已經列表時,T是我的課Plantilla

我綁定到一個GridView的,所以當我想從電網IM的價值越來越例外

調試表明我這是我的新類型爲Collection gridview.SelectedItems [0];

[0] = {System.Data.Linq.SqlClient.ObjectReaderCompiler.Group<string,Demo.View.Plantilla>} 

回答

1

在你的GridView可以設置索引字段要在你返回VAR必填字段。然後這會爲您編輯的每一行提供PK。

+0

即時通訊使用WPF,與網格和ListView在哪裏可以找到該屬性? – 2009-02-19 16:19:21