I'm developing a scholl project(using asp.net core Web Application) and i select data from a sql server database using a stored procedure into a SqlDataReader, that returns that The return of the stored procedure.
I already passed that SQLDataReader to my html View, now i need to display that data into a html table like this:Table edited in paint to get the desired result, I'm not getting the result I want because i can't work correctly with the data.
That's how i execute the stored Procedure.
SqlCommand cmd = new SqlCommand("tentativa1", conn);
cmd.CommandType = System.Data.CommandType.StoredProcedure;
cmd.Parameters.Add(new SqlParameter("@tempo", "day"));
cmd.Parameters.Add(new SqlParameter("@ap_id", "18"));
SqlDataReader rdr = cmd.ExecuteReader();
That's the code i use to pass the SqlDataReader to the view:
public class MyViewModel
{
public List<teste> objteste { get; set; }
public SqlDataReader rdr { get; set; }
public List<L_AccessPoint> objAcessPoint { get; set; }
}
And thats the code i use to "catch" the data that i pass to the view:
@model MyViewModel
I dont know if use a SqlDataReader is the best way to work with data or if is better use other thing.
If you could help me displaying the desired result, I will be very grateful.



