”where in“ parameter splicing problem
Open
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 18.4k
- Forks
- 3.7k
- Avg merge
- 5h 8m
- Merged PRs (30d)
- 1
Description
Parameter 'sqlParams111' has already been defined."
demo as follows:
//test_01 and test_11 only contain two fields id and addtime
try
{
using (var conn = new MySqlConnection(connStr))
{
conn.Open();
var ids1 = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11 };
var ids2 = new List<int> { 1, 20, 18, 17 };
var sql = @"
select addtime from test_01 where id in @sqlParams1
union all
select addtime from test_11 where id in @sqlParams11";
var res = conn.Query<DateTime>(sql, new { sqlParams1 = ids1, sqlParams11 = ids2 }).ToList();
res.ForEach(s => Console.WriteLine(s));
Console.ReadKey();
}
}
catch (Exception ex)
{
throw;
}

Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
No source file or test is named. Start by reproducing the supplied C# query with two differently named IN parameters, then trace Dapper's parameter-splicing path for collection parameters. Done means both collections execute without the duplicate-parameter error and the behavior is covered by a regression test.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp, sql
- Domain
- database
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100