-->
These old forums are deprecated now and set to read-only. We are waiting for you on our new forums!
More modern, Discourse-based and with GitHub/Google/Twitter authentication built-in.

All times are UTC - 5 hours [ DST ]



Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 
Author Message
 Post subject: Select attributes with a specific query
PostPosted: Mon Feb 19, 2007 12:29 pm 
Newbie

Joined: Mon Feb 19, 2007 12:18 pm
Posts: 1
I have a class Client with many attributes, but for now i just need to select two of them:

Code:
IList results = session.Find("select clients.Code, clients.Name from ClientsEntity as clients where clients.Recomended_id = " + client.Id);


I'm having problems extracting the information cause i receive a object []. the results are correct but i don't know how to extract them to a datagrid. I know I can do find to the entity itself like this:

Code:
IList results = session.Find("from ClientsEntity as clients where clients.Recomended_id = " + client.Id);


Although, this will just solve my problem for now, cause later i will need to do very complex queries, including attributes from many tables at the same time.. This will result in a object[] variable again..

What's the best way to do what i want? I know that if i have an entity itself it would be easy.. I just needed to do a simple cast to the variable I want.. but what about getting custom data from the database? How can i access it in the C# code and display it then in a datagrid?

Thanks


Top
 Profile  
 
Display posts from previous:  Sort by  
Forum locked This topic is locked, you cannot edit posts or make further replies.  [ 1 post ] 

All times are UTC - 5 hours [ DST ]


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
© Copyright 2014, Red Hat Inc. All rights reserved. JBoss and Hibernate are registered trademarks and servicemarks of Red Hat, Inc.