Click here to Skip to main content
15,887,468 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more: , +
Hi.

When I use this select in a entitydatasource.CommandText:

CommandText="SELECT it.[LiteratureID], it.[ReleaseDate], it.[Title], it.[Text], it.[ThreadID], it.[Added], (SELECT COUNT(fp.PostID) FROM ForumPosts AS fp WHERE fp.ThreadID = it.[ThreadID] AND fp.Status = 1) AS Posts FROM Literature AS it WHERE it.[Status] = 4 ORDER BY it.[ReleaseDate] DESC SKIP 5 LIMIT 1"


I get this, when I bound the data:

System.Collections.Generic.List`1[System.Data.Common.DbDataRecord] 


It should have been a number.

UPDATE:
Resolved by OP himself. Posted as an answer.
Posted
Updated 29-Jan-11 18:17pm
v2

Found a solution.

Adding VALUE to the nested SELECT returned a list of Int32 insted.

Binding like this, returned the value:

Comments='<%# Eval("Posts[0]") %>'
 
Share this answer
 
v2
Thank you. This was a HUGE help!
 
Share this answer
 
Comments
[DK]KiloDunse 10-Feb-11 6:57am    
Glad I could help.
Thanks very much. It is really a very appeciatable help.
I used in query like in aspx page :

<asp:entitydatasource id="LogsEntityDataSource" runat="server" connectionstring="name=CNDBEntities" xmlns:asp="#unknown">
DefaultContainerName="DBEntities" EnableFlattening="False" EntitySetName="Logs"
Select="it.Message, Count(it.Message) as Count, it.Logger as Location, it.Level, (Select VALUE l.Id from Logs as l where l.Message = it.Message and l.Logger = it.Logger and l.Level = it.Level) as Id"
GroupBy="it.Message,it.Logger,it.Level"
OrderBy="it.Count DESC" >


While binding written as said :
<a href="/logs/view-all.aspx?id=<%#Eval("Id[0]")%>">View All</a>Delete</a>

Thanks
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900