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

时间:2014-07-09 11:52:45

标签: c# sql select sql-server-ce

我的选择查询出现以下错误:

enter image description here

以下是有问题的选择查询:

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;
    }
}

错误表示ntext不能与order bywhere子句一起使用。因此,我没有在我的数据库方案中使用ntext数据类型

enter image description here

那我哪里出错了?因为没有varchar数据类型 enter image description here

根据以下url

,我认为这是一些错误

1 个答案:

答案 0 :(得分:0)

ntext用于nvarchar(count或MAX)。

尝试使用varchar(100)而不是nvarchar(100)。

格尔茨