Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to get flat record set back from stored procedure in Dapper.Net
    primarykey
    data
    text
    <p>I've got a project running on SQL Server 2005. I have a stored procedure that accepts some input parameters, has 2 output parameters and also returns a result set from a select statement inside.</p> <p>The data is not intending to be returned back as objects just a simple dto class 'Foo' which does not have a primary key.</p> <p>I've tried to use Dapper.Net with the below code, but I get as far as the exception error returned </p> <blockquote> <p>When using the multi-mapping APIs ensure you set the splitOn param if you have keys other than Id</p> </blockquote> <p>Code:</p> <pre><code>var p = new DynamicParameters(); p.Add("@Code", code); p.Add("@MessageControlId", getMessageControlId); p.Add("@SuccessCode", dbType: DbType.Int32, direction: ParameterDirection.Output); p.Add("@ErrorDescription", dbType: DbType.String, direction: ParameterDirection.Output, size: 255); var result = this.db.Query(sql: "up_MessageProcessed_get", param: p, commandType: CommandType.StoredProcedure); </code></pre> <p>Should I be able to do this with Dapper.Net? Should I calling something else to get a simple resultset back?</p> <p>As requested, here is a shell of the procedure, it will set the returnvalues and also return 1 resultset.</p> <pre><code>CREATE PROCEDURE [dbo].[up_MessageProcessed_get] @Code varchar(10), @MessageControlID varchar(22), @SuccessCode int OUTPUT, @ErrorDescription varchar(255) OUTPUT AS BEGIN Select 2 as MessageProcessID, 38349348 as StartNum, 3874900 as EndNum, GETDATE() as StartDate, GETDATE() as EndDate SET @SuccessCode = 0 SET @ErrorDescription = 'Completed successfully' END </code></pre>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload