How to fix Incorrect syntax near the keyword from in ASP.NET

April 04, 2014 4 Comments

Today i facing a new problem that is
Incorrect syntax near the keyword from
I am receiving this error message when i retrieve the record from the database table, this code is successfully run in visual studio 2010 or earlier but not successfully run in vs 2012 or higher. So I think about that error and solve the problem that is

Incorrect syntax near the keyword 'from'.

Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code. 

Exception Details: System.Data.SqlClient.SqlException: Incorrect syntax near the keyword 'from'.


use brackets around the table like

Select * from [products]

If you use aggregate operators  query then should use '()' like

Select count (*) from [products]

Jacob Lefore

Some say he’s half man half fish, others say he’s more of a seventy/thirty split. Either way he’s a fishy bastard. Google


  1. I really need to have or to share this all in one site.It has a total package that you are longing to look for great idea with it and very interesting details ..GOOD JOB for that!

    PIC Scheme Singapore

  2. I really like your blog
    Thanks for sharing ...

  3. I will try to make a point to make this article your one stop to find the best...

    Read More: