Skip to content

Nullable input parameter not supplied when NULL #2187

Description

@ChristofColle-VIVES

Using Dapper 2.1.66 in a C# dotnet10 solution, connecting to a Dataverse database (TDS)...

My code is :

var queryParams = new
{
	FirstName = person.FirstName,
	LastName = person.LastName,
	Email = person.Email,
	AccountId = request.CompanyId
};

var contactId = await sqlConnection.QueryFirstOrDefaultAsync<Guid?>(Data.Queries.FindContactsForRegistration, queryParams);

The first 3 parameters are non-nullable strings.
The fourth parameter is a nullable GUID (uniqueidentifier).

My error output is :
The parameterized query '(@FirstName nvarchar(200),@LastName nvarchar(200),@Email nvarcha' expects the parameter '@AccountId', which was not supplied.

It suggests Dapper isn't providing the @AccountId parameter to the query, when its value is NULL.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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