结果视图=类型

时间:2013-03-13 15:23:41

标签: c# sql-server silverlight linq-to-sql wcf-ria-services

我正在使用Silverlight 4 ria服务和sql server 2008,

当issummary = 0时,我们使用存储过程返回我们在数据网格中显示的一些数据 当issummary = 1

时,我们使用相同的存储过程返回数据摘要

当issummary = 0时,存储过程正在返回数据,但是当issummary = 1时,它正在调整错误

Results View = The type 'VSO.Models.Server.PFO' exists in both 'VSO.Web.dll' and 'DataContractSurrogates_451c5697-49be-4ec5-9d42-89486ff684a6'

在designer.cs文件中。

以及domainservice.cs文件中的强制转换异常

指定的演员表无效。

展开:

  at System.Data.DataTableReader.GetGuid(Int32 ordinal)
   at System.Data.Linq.SqlClient.ObjectReaderCompiler.Rereader.GetGuid(Int32 i)
   at Read_PFO(ObjectMaterializer`1 )
   at System.Data.Linq.SqlClient.ObjectReaderCompiler.ObjectReader`2.MoveNext()
   at System.Collections.Generic.List`1..ctor(IEnumerable`1 collection)
   at System.Linq.Enumerable.ToList[TSource](IEnumerable`1 source)
   at VSO.DomainServices.Server.PFODomainService.PFOSelectByStores(String storeIds, Int32 filter, Int32 pageIndex, Int32 pageSize, Guid userId, String sortColumn, String productIDs, Boolean isSummary, Int32& totalRows) in C:\Hood_VSO\.VSO\.VSO.Web\Services\PFODomainService.cs:line 820

我哪里错了,有人可以帮我解决这个问题,非常感谢你

1 个答案:

答案 0 :(得分:0)

我找到了解决方案, 没有。当summary为0时,存储过程返回的列大于no。当summary为1时,存储过程返回的列数,以及那些列可以为空。

所以它正在投掷一个强制转换异常。

我为summary = 1创建了一个新的存储过程。有要求。