简体   繁体   中英

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. Therefore, I am not using ntext data type in my database scheme

在此处输入图片说明

So where did I go wrong ? because there is no varchar data type 在此处输入图片说明

i think this is some bugs, according to the following url

ntext is used to be nvarchar(count or MAX).

Try using varchar(100) instead of nvarchar(100).

Greetz

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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