-
-
Notifications
You must be signed in to change notification settings - Fork 3.7k
Open
Description
I've encountered an issue when using Dapper with SQL Server. In my SQL queries, I sometimes include '?' characters inside the string values, as a part of the string itself, not as a parameter placeholder. For example, a query might look like this:
string sql = @"INSERT INTO test_table2 ([name0],[name1],[name2]) VALUES ('?a?', '3.?a?', @name)";
var dp = new Dapper.DynamicParameters();
dp.Add("name", "qq");
conn.Execute(sql, dp);
In this example, '?a?' and '3.?a?' are string values to be inserted into the table, and @name is the only actual parameter in the query.
However, when I execute such a query with Dapper, it throws an exception with the message: "When passing parameters by position, each parameter can only be referenced once."
Is there any way to configure Dapper to correctly handle the '?' characters in SQL strings when using SQL Server?
Any help would be greatly appreciated.
Metadata
Metadata
Assignees
Labels
No labels