语法错误或访问冲突 [英] Syntax error or access violation

查看:96
本文介绍了语法错误或访问冲突的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨.....

下面给出的是我在表中插入数据的代码:USER.

hi.....

Given below is my code to insert data int a table : USER.

Dim myInsertQuery As String = "INSERT INTO USER   (USERID,PASSWORD)  Values(''roll'', ''name'')"
Dim mycommand As New OdbcCommand(myInsertQuery)
  mycommand.Connection = myConnection
  mycommand.ExecuteNonQuery()



但是代码无法正常工作...我收到下面给出的错误消息...任何人都可以提出解决方案,请先谢谢..



But the code is not working properly...i am getting the error message given below .....can any one suggest a solution please,thanks in advance..

''ERROR [42000] [Sybase][ODBC Driver][Adaptive Server Anywhere]
''Syntax error or access violation: near ''USER'' in INTO [USER]

推荐答案

用关键字命名表时,应将它们放在[]中.

When you name tables after keywords, you should put them in [].

Dim myInsertQuery As String = "INSERT INTO [USER]   (USERID,PASSWORD)  Values('roll', 'name')"


我认为您需要重命名表您正在使用的.

USER 是查询世界中的关键字.
I think you need to rename the table that you are using.

USER is a key word in query world.


始终建议不要在查询中使用关键字.您必须从此处获得一些最佳做法和编码约定.
It is always recommended not to use keywords in the query. You must read some best practices and coding conventions from here.


这篇关于语法错误或访问冲突的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆