public ModeloNegocio.Director getDirectorSchool(int idShool) { List <ModeloNegocio.Director> lista = new List <ModeloNegocio.Director>(); Cmd = new SqlCommand(); Cmd.Connection = Conn; ModeloNegocio.Director director = new ModeloNegocio.Director(); try { Cmd.CommandType = CommandType.StoredProcedure; Cmd.CommandText = "[otaku_bcp].PA_GET_DIRECTOR_SCHOOL"; Cmd.Parameters.Add("@idschool", SqlDbType.Int).Value = idShool; //Cmd.Parameters.Add("@tipoUser", SqlDbType.Int).Value = 7; Dtr = Cmd.ExecuteReader(); while (Dtr.Read()) { director.id = Convert.ToInt32(Dtr["id"].ToString()); director.Codigo = Dtr["codigo"].ToString(); director.FullName = Dtr["name"].ToString(); //lista.Add(director); } Conn.Close(); } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); } return(director); }
public ModeloNegocio.Director getDirectorSchool(int idShool) { List<ModeloNegocio.Director> lista = new List<ModeloNegocio.Director>(); Cmd = new SqlCommand(); Cmd.Connection = Conn; ModeloNegocio.Director director = new ModeloNegocio.Director(); try { Cmd.CommandType = CommandType.StoredProcedure; Cmd.CommandText = "[otaku_bcp].PA_GET_DIRECTOR_SCHOOL"; Cmd.Parameters.Add("@idschool", SqlDbType.Int).Value = idShool; //Cmd.Parameters.Add("@tipoUser", SqlDbType.Int).Value = 7; Dtr = Cmd.ExecuteReader(); while (Dtr.Read()) { director.id = Convert.ToInt32(Dtr["id"].ToString()); director.Codigo = Dtr["codigo"].ToString(); director.FullName = Dtr["name"].ToString(); //lista.Add(director); } Conn.Close(); } catch (Exception e) { Console.WriteLine("{0} Exception caught.", e); } return director; }