Anyway, I'm stuck on newb-mode at the moment and I can't seem to find the solution for this very common-yet annoying error located in the KillConnection file. It's quite large but I'll post it here anyway, This isn't my work. Credit goes to the original coder of this file. I simply need assistance in obtaining the solution.
Code:
using System;
using System.Data;
using MySql.Data.MySqlClient;
using System.Collections.Generic;
public class KillConnections
{
public static void Kill()
{
string command = "SHOW processlist";
List<ulong> processes = new List<ulong>();
MySqlConnection conn = new MySqlConnection(MySqlCmd.ConnectionString);
MySqlCommand cmd = new MySqlCommand(command, conn);
MySqlDataReader reader = null;
try
{
conn.Open();
reader = cmd.ExecuteReader();
while (reader.Read())
{
ulong identity = ulong.Parse(reader["Id"].ToString());
if (reader["Command"].ToString() == "Sleep"
&& uint.Parse(reader["Time"].ToString()) >= conn.ConnectionTimeout
&& identity > 0)
processes.Add(identity);
}
reader.Close();
reader.Dispose();
reader = null;
foreach (int identity in processes)
{
command = "KILL " + identity;
cmd.CommandText = command;
cmd.ExecuteNonQuery();
}
cmd.Dispose();
cmd = null;
}
catch (Exception e)
{
Console.WriteLine(e);
}
finally
{
if (reader != null && !reader.IsClosed)
{
reader.Close();
reader.Dispose();
reader = null;
}
if (conn != null && conn.State == ConnectionState.Open)
{
conn.Close();
conn.Dispose();
}
if (cmd != null)
{
cmd.Dispose();
cmd = null;
}
}
}
}
Code:
Error 1: The name 'MySqlCmd' does not exist in the current context






