Skip to content

Specified cast is not valid when using QueryAsync #346

Description

@pranavmehta

I have a stored procedure that selects a single big int - something like: select 10 as 'Id'.

I have the following code which works perfectly fine:

long Id = Conn.Query<long>("GetId", new { foo = bar }, commandType: CommandType.StoredProcedure).First();

However, I am unable to get it to work with QueryAsync. It always fails with "The specified cast is not valid" exception. What is the correct way to use the Async version of above code?

Note: I am able get QueryAsync to work when using complex types, but fails for simple types like in above example

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

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions