Are you going to db when you jut have what you need trough the first query ?var batchIds = new HashSet<int>(Trans.Select(cp=>cp.Batch_id));
P.S. please take your time to study ICriteria a little bit more because that resultsTrasformer with a projection don't have many sense. 2009/4/20 Viki <[email protected]> > > Hi, > > I have below C# ASP.NET code to get distinct row of Coulmn batc > id. > > config = new NHibernate.Cfg.Configuration(); > config.AddAssembly(typeof(CSTS.Main.CashPosting).Assembly); > factory = config.BuildSessionFactory(); > session = factory.OpenSession(); > query = session.CreateQuery("FROM CashPosting"); > IList<CSTS.Main.CashPosting> Trans = > query.List<CSTS.Main.CashPosting>(); > ICriteria criteria = session.CreateCriteria(typeof > (CashPosting)); > criteria.SetProjection(Projections.Distinct > (Projections.ProjectionList() > .Add(Projections.Alias(Projections.Property("Batch_Id"), > "Batch_Id")))); > criteria.SetResultTransformer(new > NHibernate.Transform.AliasToBeanResultTransformer(typeof > (CashPosting))); > IList batchidList = criteria.List(); > ddBatch_id.DataSource = batchidList; > ddBatch_id.DataBind(); > > But I am not getting the value, it gives complete row, i need only > batch id. > > > > -- Fabio Maulo --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "nhusers" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/nhusers?hl=en -~----------~----~----~----~------~----~------~--~---
