Search code examples
vb.netvisual-studio-2012query-buildertableadapter

visual studio 2012 query builder


Can anybody tell me what does the error mean? Whenever I open the query builder it will prompt with an error indicating that SQL syntax errors were encountered.

enter image description here

https://msdn.microsoft.com/en-us/library/ms189012.aspx

I looked at the following page in MSDN but I don't understand what it means...

For instance, what do these bullet points from the MSDN article mean?

  • The SQL statement is incomplete or contains one or more syntax errors.
  • The SQL statement is valid but is not supported in the graphical panes (for example, a Union query).
  • The SQL statement is valid but contains syntax specific to the data connection you are using.

Solution

  • USER (which you've apparently decided is an appropriate table name) is a SQL Server reserved word.

    The best solution is to rename your table, so you don't have to escape the table name every time you want to query it and to make it clear it's your user data (hey, there's a table name suggestion - userdata).

    The other option is to escape the name by surrounding it with square brackets:

    SELECT * FROM [users]
    

    Note that it will get old fast having to do this with every query. Again, the best solution would be to rename the table to something that isn't a reserved word.