Skip to content

Error on web garbage - When passing parameters by position, each parameter can only be referenced once #1442

@briankitt

Description

@briankitt

On a web app, some garbage was entered into an input field. Dapper blows up with a very strange error. 'When passing parameters by position, each parameter can only be referenced once'

Why is this happening? What about this garbage is causing this strange error?

Microsoft SQL Server C#

Here is some SAMPLE code where you can reproduce this bug on your own system.

                using (var dbConn = new 
                SqlConnection(ConfigurationManager.ConnectionStrings["SqlServer"].ConnectionString))
                {
                    var mySqlText = @"
                    SELECT '??e??e?' AS T
                    INTO #Test
                    ";
                    dbConn.Execute(mySqlText, new { a = 1, b = 2 });
                }

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions