NHibernate error, incorrect syntax near the keyword

Common sense, maybe…, worthy of a blog, absolutely. I was creating an ordering system using NHibernate and the table which stored the orders was called ORDER.

This resulted in an error, which I believe would come from any data retrieval source, I just happen to be using NHibernate with SQL Server and Oracle. The error is:

  • InnerException = {“Falsche Syntax in der Nähe des ‘ORDER’-Schlüsselworts.”}
  • InnerException = {“Incorrect syntax near the keyword ‘ORDER'”}

Don’t use platform keywords in your code or database. This happened with CultureInfo once too and wrote a blog about it here.