Counting instances of a value in DB

Please support our C# advertiser: Intel Parallel Studio Home
Thread Solved

Join Date: Sep 2009
Posts: 29
Reputation: benkyma is an unknown quantity at this point 
Solved Threads: 0
benkyma benkyma is offline Offline
Light Poster

Counting instances of a value in DB

 
-1
  #1
Oct 9th, 2009
I need to query a database of application titles and count the instances of each title. I've already got a list<string> of distinct values from a previous query, and now I need to count how many times each value occurs. I'm not sure if the query is correct, or how to handle the output. So far I have:

  1. SqlCommand appCommand = new SqlCommand("select count(title) from poss_titles where title = @thisTitle", appConnection);
  2. appCommand.Parameters.AddWithValue("@thisTitle", cands[i]);
  3. SqlDataReader reader;
  4.  
  5. reader = appCommand.ExecuteReader();
Last edited by benkyma; Oct 9th, 2009 at 8:46 am.
Reply With Quote Quick reply to this message  
Join Date: Sep 2009
Posts: 29
Reputation: benkyma is an unknown quantity at this point 
Solved Threads: 0
benkyma benkyma is offline Offline
Light Poster
 
0
  #2
Oct 9th, 2009
Reply With Quote Quick reply to this message  
Reply

This thread has been marked solved.
Perhaps start a new thread instead?
Message:


Thread Tools Search this Thread



About Us | Contact Us | Advertise | DaniWeb | Acceptable Use Policy | RSS Feed

©2003 - 2009 DaniWeb® LLC