프로그래밍/C#

C#에서 MySql 연결 후 DataTableTableAdapter 문제

노을지기 2011. 10. 21. 08:22

We faced the same problem with VS 2005 typed datasets.

Error:
Generated SELECT statement.
     Error in WHERE clause near '@'
     Unable to parse query text


The problem is the syntax of the datasource used for query.
For SQL Server versions, you should use @parametername syntax to define a parameter.
However, for Access database, your should put ? for parameter definition.

Example;

SQL Server version: 
SELECT    *
FROM         Projeler
WHERE     (proje_id = @projectID)

Ms Access version and MySql:
SELECT    *
FROM         Projeler
WHERE     (proje_id = ?)

출처: http://social.msdn.microsoft.com/forums/en-US/Vsexpressvb/thread/0c17511e-38a8-4040-b400-ac8eb103bd07/