473,406 Members | 2,281 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

C# Simple Statistics

karenRoss
I have an employee directory, but I want to see how many unique last name were typed in the search and how many times each last name was typed in?

I'm just not sure which direction I should take to go about this data collection

any thoughts?
Jun 12 '07 #1
6 1796
nateraaaa
663 Expert 512MB
I have an employee directory, but I want to see how many unique last name were typed in the search and how many times each last name was typed in?

I'm just not sure which direction I should take to go about this data collection

any thoughts?
You will need to save the last name searched for in a database table. Then you can run queries on this data to determine how many names have been searched for and also how many names are unique.

You could also just get the names that have been searched for (using a database query) then (in the code behind) find the unique names by adding these names (names returned by your query) to an arraylist then looping through the arraylist to find the unique names.

I have some sample code for finding unique items in an arraylist if you need it. Just let me know.

Nathan
Jun 12 '07 #2
You will need to save the last name searched for in a database table. Then you can run queries on this data to determine how many names have been searched for and also how many names are unique.

You could also just get the names that have been searched for (using a database query) then (in the code behind) find the unique names by adding these names (names returned by your query) to an arraylist then looping through the arraylist to find the unique names.

I have some sample code for finding unique items in an arraylist if you need it. Just let me know.

Nathan
Of course I'll take that sample code. I just figured I'd throw in a feature to see who is searched for the most on the directory. just for fun today.
Jun 12 '07 #3
nateraaaa
663 Expert 512MB
Of course I'll take that sample code. I just figured I'd throw in a feature to see who is searched for the most on the directory. just for fun today.
I found this code while searching for a to remove duplicates.

http://authors.aspalliance.com/olson/methods/RemoveDups.aspx

Hope this helps.

Nathan
Jun 12 '07 #4
The only problem I'm having now is getting my data sql adapter into an array
Jun 12 '07 #5
nateraaaa
663 Expert 512MB
The only problem I'm having now is getting my data sql adapter into an array
Use your dataadapter to fill a dataset then use a for loop to assign each element in the array

ArrayList array = new ArrayList();
for(int i = 0; i < dataset.Tables[0].Rows.Count; i++)
{
if (!array.Contains(dataset.Tables[0].Rows[i]["LastName"].ToString().Trim()))
{
array.Add(dataset.Tables[0].Rows[i]["LastName"].ToString().Trim()));
}

}

this should work.

Nathan
Jun 12 '07 #6
great! just as i was getting into this someone came in and dropped a project on my desk :(

i better get to it.
Jun 12 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

17
by: Felix | last post by:
Dear Sql Server experts: First off, I am no sql server expert :) A few months ago I put a database into a production environment. Recently, It was brought to my attention that a particular...
5
by: Jesper Jensen | last post by:
Hello group. I have an issue, which has bothered me for a while now: I'm wondering why the column statistics, which SQL Server wants me to create, if I turn off auto-created statistics, are so...
3
by: Metal Dave | last post by:
Hello, A script we run against the database as part of the upgrade of our product is failing with the following message: ALTER TABLE ALTER COLUMN EncodedID failed because STATISTICS hind_61_3...
2
by: Lyn Duong | last post by:
Hi, I have a job that performs a runstats on tables in my database (db2 V8 on AIX) and the syntax is db2 runstats on table schema.tabname with distribution and detailed indexes all. when I...
3
by: Fan Ruo Xin | last post by:
I ran the runstats and try to collect sub-element statistics, but for some reason, the value of that two fields in syscat.columns is always -1. Does anyone have any idea?
2
by: Ross A. Finlayson | last post by:
Hi, I wonder if there is a simple library or set of functions for basic statistical functions, like what may be on a pocket calculator, without getting into linking into the language runtimes of...
1
by: Chris Weston | last post by:
Hi. I have automatic statistic update turned on for all my databases. Is this an overhead I can do without? Could I update them overnight when the database is hardly in use? Thanks --...
17
by: romixnews | last post by:
Hi, I'm facing the problem of analyzing a memory allocation dynamic and object creation dynamics of a very big C++ application with a goal of optimizing its performance and eventually also...
5
by: Allan Ebdrup | last post by:
Hi We have a large class library of different classes, now we are going to implement a lot of usage statistics that we need, stuff like how many times a user has logged in, how many times a...
2
by: Quasar | last post by:
Hi everybody! I''ve created a script that enable the statistics for a specific DB: #!/bin/sh if ; then echo Enabling monitoring switches for ${1} db2 connect to ${1} db2 update monitor...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.