Ejemplo n.º 1
0
        public Livelli GetByID(int ID)
        {
            using (SqlConnection connection = new SqlConnection(connectionString))
            {
                Livelli livello = new Livelli();
                try
                {
                    connection.Open();
                    SqlCommand command = new SqlCommand();
                    command.Connection  = connection;
                    command.CommandType = System.Data.CommandType.Text;
                    command.CommandText = "SELECT * FROM Livelli WHERE ID = @ID";

                    command.Parameters.AddWithValue("@ID", ID);

                    SqlDataReader reader = command.ExecuteReader();

                    reader.Read();
                    livello = reader.ToLivelli();

                    reader.Close();
                }
                catch (SqlException)
                {
                    Console.WriteLine("Errore in GetAllWithFilter in livelli");
                }
                finally
                {
                    connection.Close();
                }
                return(livello);
            }
        }
Ejemplo n.º 2
0
 public bool Update(Livelli obj)
 {
     throw new NotImplementedException();
 }