public TahlilEntities TahlilIDyeGore(int TahlilID) { TahlilEntities currentUser = new TahlilEntities(); cmd = new SqlCommand("Select * From Tahliller Where TahlilID = @id", conn); cmd.Parameters.AddWithValue("@id", TahlilID); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); reader.Read(); currentUser.TahlilID = reader.GetInt32(0); currentUser.TahlilAdi = reader.GetString(1); reader.Close(); return(currentUser); }
public List <TahlilEntities> TumTahlilleriGetir() { List <TahlilEntities> TahlilList = new List <TahlilEntities>(); cmd = new SqlCommand("Select * From Tahliller", conn); TahlilEntities currentUser = null; conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { currentUser = new TahlilEntities() { TahlilID = reader.GetInt32(0), TahlilAdi = reader.GetString(1), }; TahlilList.Add(currentUser); } reader.Close(); return(TahlilList); }