简体   繁体   English

使用linq从本地SQL Server Compact Edition数据库中选择

[英]Select from local SQL Server Compact Edition database using linq

I get the following error about my select query: 我收到有关选择查询的以下错误:

在此处输入图片说明

Here is the select query in question: 这是有问题的选择查询:

public int countLogin(string username, string password)
{
    try
    {
        int query = (from a in de.userlogin
                     where a.username == username && a.password == password
                     select a).Count();
        return query;   
    }
    catch (Exception e)
    {
        MessageBox.Show(e.ToString());
        return 0;
    }
}

The error said that ntext cannot be used with order by or where clause. 该错误表明ntext不能与order bywhere子句一起使用。 Therefore, I am not using ntext data type in my database scheme 因此,我不在数据库方案中使用ntext数据类型

在此处输入图片说明

So where did I go wrong ? 那我哪里出错了? because there is no varchar data type 因为没有varchar数据类型 在此处输入图片说明

i think this is some bugs, according to the following url 我认为这是一些错误,根据以下网址

ntext is used to be nvarchar(count or MAX). ntext曾经是nvarchar(count或MAX)。

Try using varchar(100) instead of nvarchar(100). 尝试使用varchar(100)而不是nvarchar(100)。

Greetz 格蕾兹

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

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