hi people i really need help in this.
i have a c# win form which helps me in taking database from access, putting it into an array and counting the word based on user search. Each form will contain different number of words that the user search so anyone know how to rank the count at the end in descending form.
private void btnSearch_Click(object sender, EventArgs e)
{
cmd = new OleDbCommand(sqlstr, con);
OleDbDataReader reader = cmd.ExecuteReader();
while (reader.Read())
{
int i = 0;
string words = "";
words = (reader[2].ToString());
string[] sep = { "," };
string[] names = keywords.Split(sep, StringSplitOptions.RemoveEmptyEntries);
int count = 0;
for (i = 0; i < names.Length; i++)
{
if (names[i].Contains(searchtext.text))
{
count++;
}
}
if (count != 0)
{
outputLabel.Text += reader[1].ToString() + " = " + reader[2].ToString() + "\n\n Number of word searched:" + count + "\n\n";
}
}
}
currently this is my code. i tried putting the count into an arraylist and sort it from there but it does not work. so anybody has any idea.