model view controller - Get string value from QueryMultiple result -
in dotnetcore
project, i've query returns multiple resultsets using querymultiple
...
this query
var sql = @"select countryid id, countryname name country; select cityid id, cityname name, countryid city; select citizenshipid id, citizenshipname name citizenship; select count(user.userid) totalusercount identityuser user;";
this how i'm getting result variable
using (idbconnection dbconnection = new dbmanager().connection) { dbconnection.open(); var grid = dbconnection.querymultiple(sql, new { }); manageprofileview.countries = grid.read<country>().tolist(); manageprofileview.cities = grid.read<city>().tolist(); manageprofileview.nationalities = grid.read<citizenship>().tolist(); }
now how data of query
select count(user.userid) totalusercount identityuser user;
i've tried this
var usercount = grid.read().tolist();
but not returning valid data, there better way simple count grid
variable.
i believe need corresponding count of list, try:
var usercount = grid.read().tolist().count;
Comments
Post a Comment