public TeshisEntities TEshisIDyeGore(int TeshisID) { TeshisEntities currentUser = new TeshisEntities(); cmd = new SqlCommand("Select * From Teshisler Where TeshisID = @id", conn); cmd.Parameters.AddWithValue("@id", TeshisID); conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); reader.Read(); currentUser.TeshisID = reader.GetInt32(0); currentUser.TeshisAdi = reader.GetString(1); reader.Close(); return(currentUser); }
public List <TeshisEntities> TumTeshisleriGetir() { List <TeshisEntities> TeshisList = new List <TeshisEntities>(); cmd = new SqlCommand("Select * From Teshisler", conn); TeshisEntities currentUser = null; conn.Open(); SqlDataReader reader = cmd.ExecuteReader(CommandBehavior.CloseConnection); while (reader.Read()) { currentUser = new TeshisEntities() { TeshisID = reader.GetInt32(0), TeshisAdi = reader.GetString(1) }; TeshisList.Add(currentUser); } reader.Close(); return(TeshisList); }