In a 3 tier architecture (C# , ADO.NET), are datasets and datatables the only option to return data from the Data Layer to the Presentation Layer?. I've been working with Datatables but when I will ttry to do this
public User getUserByP(User user)
{
User t = new User();
using(SqlConnection con = new SqlConnection(Conexion.Cn))
{
con.Open();
SqlCommand command = new SqlCommand("spLogIn_User", con);
command.CommandType = CommandType.StoredProcedure;
command.Parameters.AddWithValue("@user", User.user);
command.Parameters.AddWithValue("@password", User.Pass);
SqlDataReader reader = command.ExecuteReader();
while (reader.Read())
{
t.IdUser = reader.GetInt32(0);
t.Name = reader.GetString(1);
t.LastName = reader.GetString(2);
t.Access = reader.GetString(3);
t.user = reader.GetString(4);
t.Pass = reader.GetString(5);
}
}
return t;
}
I ill have an error cause there is no communication between Data Layer and Presentation Layer. This is posible in MVC (i think) but no here. So if a just want return even 1 result , datatble or dataset are only option?