Azure SQL Database: "No columns were selected" when calling a stored procedure using Dapper
<p>I have a really simple stored procedure in Azure SQL Database:</p>

<pre><code>CREATE PROCEDURE dbo.spfindPartialIdentity 
    @ClientId nvarchar(50),
    @ExternalId nvarchar(250)
AS BEGIN
   SET NOCOUNT ON;

   SELECT 
       ClientId, ExternalId 
   FROM 
       [dbo].[PartialIdentities] 
   WHERE 
       ClientId = @ClientId AND ExternalId = @ExternalId
END
</code></pre>

<p>and I invoke it using Dapper from my repository:</p>

<pre><code>using (var conn = new SqlConnection(ConfigurationManager.ConnectionStrings["ReportingDB"].ConnectionString))
{
    await conn.OpenAsync();
    var res = await conn.QueryAsync&lt;PartialIdentity&gt;("dbo.spfindPartialIdentity", 
                                                      new { ClientId = clientId, ExternalId = externalId }, 
                                                      commandType: CommandType.StoredProcedure, 
                                                      commandTimeout: GetCommandTimeout());

    return res.ToList();
}
</code></pre>

<p>Really straightforward. I works fine, BUT when the stored procedure returns no results I got a  </p>

<blockquote>
  <p>'System.InvalidOperationException' in Dapper.dll, "No columns were selected" </p>
</blockquote>

<p>exception when calling <code>QueryAsync()</code>. My DTO is really simple as well:</p>

<pre><code>public class PartialIdentity
{
    public PartialIdentity(string clientId, string externalId)
    {
        this.ClientId = clientId;
        this.ExternalId = externalId;
    }

    public string ClientId { get; set; }
    public string ExternalId { get; set; }
}
</code></pre>

<p>I've tried <code>QueryMultipleAsync()</code> as well, same result.</p>

<p>What is the problem? Thanks in advance</p>