Linq to SQL NotSupportedException在Windows Phone 8中但不在Windows Phone 7.5中 [英] Linq to SQL NotSupportedException in Windows Phone 8 but not in Windows Phone 7.5

查看:90
本文介绍了Linq to SQL NotSupportedException在Windows Phone 8中但不在Windows Phone 7.5中的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

私有函数GenericName(ByVal TradeName为String)为String

Private Function GenericName(ByVal TradeName as String) as String

将MyMedsList屏蔽为List(Of Med)= Nothing

Dim MyMedsList as List(Of Med) = Nothing

将db设置为新的MedDataContext(数据源='appdata://Medication.sdf';文件模式=只读;)

Dim db as new MedDataContext("Data Source = 'appdata://Medication.sdf'; File Mode = read only;")

以db.Meds中的c作为IQueryable(Of Med)=的暗查询,其中c.Trade = TradeName

Dim query as IQueryable(Of Med) = from c in db.Meds where c.Trade = TradeName

MyMedsList = query.ToList

MyMedsList = query.ToList

返回MyMedsList.item(0).Generic

Return MyMedsList.item(0).Generic

结束功能

此代码在Windows Phone 7.5中可以正常运行,但在Windows Phone 8中会产生例外:

This code works perferctly in Windows Phone 7.5 but in Windows Phone 8 it generates an excecption:

System.NotSupportedException未由用户代码处理
  HResult = -2146233067
  Message =方法'Int32 CompareString(System.String,System.String,Boolean)'不支持对SQL的转换.
 来源= System.Data.Linq
  InnerException:

System.NotSupportedException was unhandled by user code
  HResult=-2146233067
  Message=Method 'Int32 CompareString(System.String, System.String, Boolean)' has no supported translation to SQL.
  Source=System.Data.Linq
  InnerException:

显然有Phone 7./5和Phone 8之间有什么区别?

Apparently there's  a difference between Phone 7./5 and Phone 8?

如何解决此问题?

推荐答案

路易斯,

欢迎来到MSDN论坛.

我认为Windows Phone论坛更适合您的问题,因此,我将把您的话题转移到该论坛上以获得更好的支持.造成不便之处,敬请谅解.

早上好.


这篇关于Linq to SQL NotSupportedException在Windows Phone 8中但不在Windows Phone 7.5中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆