Today with the dapper update is used in the writing, the garden to find an article to write
Traditional SQL in (dapper) is written like this
Conn. Query<users> ("SELECT * from Users s WHERE s.id in (@ids)", new {ids = new int[]{1,2,3}}) conn. Query<users> ("SELECT * from Users s WHERE s.id in (@ids)", new {ids = Ids.toarray ()})
After the use of the show,
System.Data.SqlClient.SqlException: "", "there is a syntax error nearby. ”
Such a hint,
When you trace an SQL statement, you find that the SQL statement generated by the method is as follows:
exec sp_executesql N'update websitechanellistpage set status=0 where ID in ((@ilist1, @ilist2)) ', N'@ilist1 int, @ilist2 int',@ilist1=1, @ilist2=2
It is not difficult to find that the resulting statement has a layer of parentheses in it, so the fruit segment modifies the code:
= "updateset status=0wherein@ilist"; Connection. Execute = idlist. ToArray ()});
Successful execution! Problem Solving!
Of course there may be my Dapper version of the problem, I used to be: Dapper 1.50.4.0
The wording of the condition in dapper