This code will give you top 10 posters of Community Server application. Add this in /Themes/yourtheme/Common/home.aspx so that the list will be displayed in home page.

<%
	SqlConnection con = new SqlConnection(ConfigurationManager.ConnectionStrings["SiteSqlServer"].ConnectionString);
        SqlDataAdapter da = new SqlDataAdapter("select top 10 postauthor, count (*) as posts from cs_posts group by postauthor order by posts desc", con);
        DataTable dt = new DataTable();
        da.Fill(dt);
 
	foreach (DataRow dr in dt.Rows)
        {
		Response.Write("<li> <a href="http://kidoos.net/members/&quot;+dr[&quot;postauthor&quot;].ToString()+&quot;/default.aspx">" + dr["postauthor"].ToString().Substring(0, 1).ToUpper() + dr["postauthor"].ToString().Substring(1,dr["postauthor"].ToString().Length-1)  +" ("+dr["posts"].ToString()+")</a>");
 
        }
 
        con.Dispose();
        da.Dispose();
        dt.Dispose();
 
%>
VN:F [1.1.6_502]
Rating: 0.0/5 (0 votes cast)
Share:
  • Digg
  • del.icio.us
  • Facebook
  • Google
  • DotNetKicks
  • LinkedIn
  • Live
  • MySpace
  • StumbleUpon
  • Technorati

Related posts:

  1. Build DateTime from values
  2. List Server Varilables with ASP.NET
  3. Visual Studio 2010 – my read bits
  4. Skype Online Status and Yahoo Messenger Online Status
  5. Using HTTPService of Flex to get data from ASP.NET