Skip to content

Instantly share code, notes, and snippets.

@taylonr
Created February 20, 2012 17:30
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Embed
What would you like to do?
PetaPoco Stored Procedure Return Value
var sql = new Sql().Append("declare @@result int")
.Append("exec GetData @userId, @date",
new {userId = userId, @date = DateTime.Now})
.Append("select @@result);
var ret = Database.ExecuteScalar<int>(sql);
@sreevinithaa
Copy link

When i try this i am getting null......Need help pls

@AndSDev
Copy link

AndSDev commented Jun 28, 2016

var sql = new Sql().Append("declare @@result int")
    .Append("exec @@result = GetData @userId, @date", 
        new {userId = userId, @date = DateTime.Now})
    .Append("select @@result");

var ret = Database.ExecuteScalar<int>(sql);

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