我正在用 C#.NET 编写程序我想收集一个类的总频率(假设每个类都有很多单词,每个单词在相应的类中都有自己的频率)
所以我在mysql中使用了sum()函数。但是有一个错误说我的演员表是错误的。
public void average_each_type()
{
MySqlDataReader result;
int total_freq = 0;
string type = "";
command.CommandText = "select class_name ,SUM(frequency) as sum_of_freq from training_set group by class_name ";
result = command.ExecuteReader();
while (result.Read())
{
total_freq = (int)result["sum_of_freq"]; //error happened here
type = result["class_name"].ToString();
//.....then so on...//