Are you going to db when you jut have what you need though the first query ?var
batchChildren = Trans.Select(cp=>cp.Batch_id);

2009/4/20 Viki <[email protected]>

>
> Hi,
>
> Below code i am using to get the distinct row of coulmnn batch id
> using Hibernate. Here when i am binding with Dropdown, complete row is
> coming, i need to bind only Batch id coulmn.
>
>
>
> 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();
>
>
>
> How can we get only Batch id from list?
>
> >
>


-- 
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to