【问题标题】:Results View = The type结果视图 = 类型
【发布时间】:2013-03-13 15:23:41
【问题描述】:

我正在使用 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

我哪里出错了,谁能帮我解决这个问题,非常感谢

【问题讨论】:

  • 由于wcf ria服务处理DataContract的方式,您报告的错误通常是由调试器报告的,是调试器引发的错误还是网络服务器本身引发的错误?

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


【解决方案1】:

我找到了解决方案, 没有。当summary 为0 时存储过程返回的列的数量大于no。当摘要为 1 时存储过程返回的列数,并且这些列也可以为空。

所以它抛出了一个强制转换异常。

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

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2020-02-13
    • 2012-08-19
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2019-08-29
    • 1970-01-01
    相关资源
    最近更新 更多