System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'FUNCTION'.'

J L 26 Reputation points
2022-11-20T18:40:56.63+00:00

I followed all the steps in the c# procedure "Create a Windows Forms user control that supports simple data binding" and it worked fine.
Then I did the same, but instead of one Usercontrol I created four, and whenever I click on the Save button (created automatically) I get the message

System.Data.SqlClient.SqlException: 'Incorrect syntax near the keyword 'FUNCTION'.'

I appreciate any help.

262295-image.png

Developer technologies | C#
Developer technologies | C#
An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
{count} votes

1 answer

Sort by: Most helpful
  1. Viorel 125.8K Reputation points
    2022-11-21T13:02:17.477+00:00

    Try avoiding special names, or use "[ ]" if you write SQL commands manually. For example: select [FUNCTION] from MyTable.


Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.