Click here to Skip to main content
15,907,233 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i have gridview and i want show no of photos according to profile id..I used following but it gives error:

XML
<asp:BoundField DataField="ADD_USER_ID" HeaderText="Profile Id"/>
   <asp:BoundField DataField="PHOTO_ID" HeaderText=" Uploaded Photos" />



cs code:
SysATGlobal.DB.ExecuteSelectQueryForGridView("SELECT ADD_USER_ID,COUNT(PHOTO_ID) FROM DSActor.DTL_PHOTOS GROUP BY ADD_USER_ID", ref GrdATviewdata);

it gives error:
"A field or property with the name 'PHOTO_ID' was not found on the selected data source."

plz help me?
Posted
Updated 7-Dec-12 20:26pm
v3

Hi,

Use this query

"SELECT ADD_USER_ID,COUNT(PHOTO_ID) as 'PHOTO_ID' FROM DSActor.DTL_PHOTOS GROUP BY ADD_USER_ID"
 
Share this answer
 
v2
try this

SQL
SELECT ADD_USER_ID,COUNT(PHOTO_ID) as ID FROM DSActor.DTL_PHOTOS GROUP BY ADD_USER_ID


and in gridview


ASP.NET
<asp:boundfield datafield="ADD_USER_ID" headertext="Profile Id"  />
   <asp:boundfield datafield="ID" headertext=" Uploaded Photos" />


Hope this solution will Work for you :)
 
Share this answer
 
v2

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