Paremeters in TableAdapter not accepted

自闭症网瘾萝莉.ら 提交于 2019-12-10 20:34:21

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!