-->
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: IQuery with a join, How to reference fields in Bound Fields?
PostPosted: Wed Dec 30, 2009 12:18 pm 
Beginner
Beginner

Joined: Thu Oct 08, 2009 11:44 am
Posts: 21
Location: Chicago
Basically a reference problem. I have a query that joins two tables together. There is at least one field named the same between the two (for the join).

I return an IList and assign it to the datasource of control with bound fields. But It can't find the fields in the rows.

Code:
            Dim myQuery As IQuery = session.CreateQuery("from DB_Associate a, DB_Association ass  where a.User_ID = ass.User_ID and ass.Account_ID = :acctNum")
            myQuery.SetParameter("acctNum", acctNum)
            resultList = myQuery.List()

With the result bound to the DetailsView

        usersDV.DataSource = userList  <--from resultsList above
        usersDV.DataBind()



The data control (DetailsView)

Code:
                <asp:DetailsView ID="usersDV" runat="server" Height="50px" Width="390px">
                    <Fields>
                        <asp:BoundField DataField="a.User_ID" HeaderText="User_ID" />
                        <asp:BoundField DataField="User_Name" HeaderText="User Name" />
                        <asp:BoundField DataField="EMail" HeaderText="EMail" />
                        <asp:ButtonField CommandName="showUserPermissions" Text="User Permissions" />
                    </Fields>
                </asp:DetailsView>


The Tables Objects fields:
Associate: (class DB_Associate, table Associate)

User_ID As Integer
User_Name As String
Email As String
...

Association: (class DB_Association, table Association)

ID As Integer
User_ID As Integer
Account_ID As Integer


I have tried a few combinations and have not found documenation that would help yet.



I get:


A field or property with the name 'a.User_ID' was not found on the selected data source.


Which suggests that I need to find the right reference for the field.

--John Putnam


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.