ExecuteSprocAccessor how to return a string from a stored procedure?

I am using Enterprise Library 5, successfully configured the database, but now I am facing the following problem.

I have a stored procedure that is a simple select statement that returns 1 row (and not an output parameter).

In the code, I wrote:

var result = _db.ExecuteSprocAccessor<string>("GetTypeOfPerson", mapper, parameters);

However, this will not work, since the string does not have a constructor without parameters. Anyway? Or how can I call a stored procedure in the corporate library and get the result?

+3
source share
1 answer

which really won't work. Instead, do the following:

var result = _db.ExecuteScalar("GetTypeOfPerson", parameters);

This will give you exactly one result.

+4
source

Source: https://habr.com/ru/post/1763751/


All Articles