SqlQuery类(声明,则params)

时间:2012-06-13 03:51:33

标签: sql entity-framework

我想知道怎么做:

params= new object[]{ new SqlParameter("ID",val),new SqlParameter("Label","'%Name%'")};
statement = "Select ID, Label from Country Where ID = ? or or Label Like ?";

我试过了,它给了我:

  

'?'附近的语法不正确。

1 个答案:

答案 0 :(得分:2)

你有一个错字:

"Select ID, Label from Country Where ID = ? or or Label Like ?";

应该是

"Select ID, Label from Country Where ID = ? or Label Like ?";