开发者

SQL command problems (C# Winforms)

开发者 https://www.devze.com 2023-01-09 21:07 出处:网络
I am successfully connecting to my sql 2008 server hosted on winhost.com. Bu开发者_开发知识库t I am following this tutorial: http://www.codeproject.com/KB/database/sql_in_csharp.aspx which was suggest

I am successfully connecting to my sql 2008 server hosted on winhost.com. Bu开发者_开发知识库t I am following this tutorial: http://www.codeproject.com/KB/database/sql_in_csharp.aspx which was suggested in an answer from: Connecting to SQL Server Database C#-WinForms and I keep getting the exact same error when I try to:

  • Insert something into the table.
  • Retrieve something from the db.

The error is: "Incorrect syntax near the keyword 'table'.".

I don't know what's wrong. The error message is very vague, and everything seems to look fine.

I am using all the examples from the above tutorial, but they all give the same error.

Any suggestions? Does anyone have any other tutorials/articles for me I can have a look at?

Thank you


Where it says INSERT INTO table ... you have to change table to be the actual name of your table as it says in the text just beneath:

Now we will take a look at the values. table is simply the table within the database.

If you chose to call your table table then you can write [table] but it would be better to change the table name to something else.


Where table appears in that tutorial, it's meant to be a 'placeholder' for an actual table name - table by itself is an illegal table name - hence the syntax error. If you need to use this name then [table] would be fine.


TABLE is a reserved word, try surrounding it with brackets, if you have created a table called table.

[table]
0

精彩评论

暂无评论...
验证码 换一张
取 消