解析查询时出错。 [令牌行号= 1,令牌行偏移= 20,令牌错误= - ] C#

时间:2015-07-10 09:03:04

标签: c# database sqlcommand sdf

我在C#中使用SQL Server Compact 3.5数据库文件(# http://symfony.com/doc/current/book/security.html#hierarchical-roles role_hierarchy: ROLE_ADMIN: [ROLE_CONCIERGE] ROLE_SUPER_ADMIN: [ROLE_CONCIERGE, ROLE_USER, ROLE_ADMIN, ROLE_ALLOWED_TO_SWITCH] # http://symfony.com/doc/current/book/security.html#where-do-users-come-from-user-providers providers: fos_userbundle: id: fos_user.user_provider.username # the main part of the security, where you can set up firewalls # for specific sections of your app firewalls: # … le pare-feu « dev » # Firewall principal pour le reste de notre site dev: pattern: ^/(_(profiler|wdt)|css|images|js|ws)/ security: false main_login: pattern: ^/login$ anonymous: true main_resettingRequest: pattern: /resetting/request$ anonymous: true main_resettingSendEmailt: pattern: /resetting/send-email$ anonymous: true main_resettingCheckEmail: pattern: /resetting/check-email$ anonymous: true main: pattern: ^/ anonymous: false provider: fos_userbundle form_login: login_path: /login check_path: /login_check csrf_provider: form.csrf_provider logout: path: /logout target: / invalidate_session: false remember_me: key: %secret% # with these settings you can restrict or allow access for different parts # of your application based on roles, ip, host or methods # http://symfony.com/doc/current/book/security.html#security-book-access-control-matching-options access_control: #- { path: ^/members/hello, roles: IS_AUTHENTICATED_ANONYMOUSLY } );我可以从.sdf读取代码,但我想从albums_tbl或其他表中读取错误:

  

解析查询时出错。 [令牌行号= 1,令牌   line offset = 20,Token in error = - ]

users-tbl表有两列:albums_tbl

这是我的代码:

id, name

enter image description here

enter image description here

2 个答案:

答案 0 :(得分:2)

请改为尝试:

SqlCeCommand cm = new SqlCeCommand("SELECT * FROM [users-tbl]", cn);

答案 1 :(得分:2)

确保使用[](T-SQL)或""转义名称。 (ANSI SQL)。您正在使用" - "表格的非标准命名。

"SELECT * FROM [users-tbl]"