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); } }
public bool Update(Livelli obj) { throw new NotImplementedException(); }