c#sql error"解析查询时出错#34;

时间:2015-01-27 10:10:01

标签: c# sql sql-server-ce

我是新手在c#中使用sql,所以这可能是非常愚蠢的错误)我正在尝试计算表中所有不同的行,但是我有以下错误:

  

解析查询时出错。 [令牌行号= 1,令牌行偏移= 14,令牌错误= DISTINCT]

这是我的代码:

        string count_query_sttring = @"SELECT COUNT(DISTINCT PO_Name) AS bla FROM OPS_List";
        string connection_string = @"Data Source=|DataDirectory|\OPS_Base.sdf";

        using (SqlCeConnection connection = new SqlCeConnection (connection_string))
        {
         SqlCeCommand command = new SqlCeCommand(count_query_sttring, connection);
         connection.Open();
         SqlCeDataReader reader = command.ExecuteReader(); //here is my error
         try
         {

我希望有人能帮助我.Thx

0 个答案:

没有答案