简体   繁体   English

SQL Server Compact 3.5查询运算符

[英]SQL Server Compact 3.5 Querying Operator

i am trying to display the ID number by using this query 我正在尝试使用此查询显示ID号

IQueryable<ToDoList> todolistQuery = from c in context.ToDoList where c.Title == NavigationContext.QueryString["Title"] & c.Description == NavigationContext.QueryString["Desc"] & c.Id == NavigationContext.QueryString["Id"] select c;

This Line: 这条线:

c.Id == NavigationContext.QueryString["Id"]

has a red underline below it stating int ToDoList.Id Error: Operator '==' cannot be applied to operands of type 'int' and 'string' 下面有一个红色下划线,表示int ToDoList.Id错误:运算符'=='无法应用于类型'int'和'string'的操作数

What have I actually done wrong? 我实际上做错了什么? How do I solve it? 我该如何解决? Thanks 谢谢

Convert your NavigationContext.QueryString["Id"] to integer : 将您的NavigationContext.QueryString["Id"]转换为integer

c.Id == Convert.ToInt32(NavigationContext.QueryString["Id"])

And it should be fine. 而且应该没问题。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM