0

这是我的 escenary,我有一个名为 Plantilla 的类,其中包含允许在 wpf 中绑定一个 gridview 的多个属性,所以这已经工作了,但是用户告诉我他们需要通过数据库中的某个字段重新分组查询,所以我准备这个片段:

  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?因为当 T 是我的班级 Plantilla 时,我现在有一个列表

我将它绑定到一个网格视图,所以当我想从网格中获取值时,我得到了异常

调试告诉我这是我在 gridview.SelectedItems[0] 中的新型集合;

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

1 回答 1

1

在您的 gridview 中,您可以将索引字段设置为返回的 var 中的必填字段。然后,这将为您提供编辑的每一行的 PK。

于 2009-02-19T16:02:07.073 回答