问题
I'm currently trying to set up my TableAdapters, but it doesn't allow me to use parameters (what makes it quite useless) - When I create a new Query
SELECT users.*
FROM users
WHERE name LIKE @name
It tells me there is a SQL-Error near '@'
...
I'm using VS08 with C# and an Access-Database using OleDB-Driver
回答1:
Look here:
How to: Create Parameterized TableAdapter Queries
When constructing a parameterized query, use the parameter notation specific to the database you are coding against. For example, Access and OleDb data sources use the question mark '?' to denote parameters, so the WHERE clause would look like this: WHERE City = ?.
Try to substitute @ with ? and see if your query compiles.
来源:https://stackoverflow.com/questions/3316450/paremeters-in-tableadapter-not-accepted