locked
Using Return Values in the new Enterprise Library Data Access Block RRS feed

  • Question

  • User1014708013 posted
    Hi there, Can anyone tell me what's the (best) way to get a return value from a stored procedure using one of the methods in the new Data Access Application Block in the Enterprise Library? I used to do this with a parameter with a direction of ReturnValue. However, with the new block, the AddParameter method has a signature that expects more parameters than I can supply. E.g. it expects a sourceColumn, sourceVersion and value, while all I want is to capture the value returned by the RETURN statement in my procedure. Any hints or ideas for this? Am I overlooking something? Thanks in advance for any help. Imar
    Sunday, March 6, 2005 3:13 PM

All replies

  • User1014708013 posted
    I think I figured it out. It's not so much different than it used to be in the DAAB or ADO.NET: IDbDataParameter myParam = dbCommandWrapper.Command.CreateParameter(); myParam.DbType = DbType.Int32; myParam.ParameterName = "@RETURN_VALUE"; myParam.Direction = ParameterDirection.ReturnValue; dbCommandWrapper.Command.Parameters.Add(myParam); // Execute command here int returnValue = Convert.ToInt32(myParam.Value); Are there other (or shorter) ways to do the same thing? Cheers, Imar
    Sunday, March 6, 2005 3:33 PM
  • User1863596672 posted

    Thank you so much for this post! I've been looking everywhere for how to do this with the Enterprise Library Data Access Block!

    Beth

    Wednesday, November 26, 2008 8:00 AM