Here is my complete program
public bool proccescheck()
{
int count=0;
MyCmd = new OdbcCommand();
MyConn = new OdbcConnection("DRIVER={MySQL ODBC
3.51 Driver};" + "SERVER=localhost;" +
"DATABASE=connector;" + "UID=root;" +
"PWD=root;");
MyConn.Open();
MyCmd.Connection = MyConn;
StringBuilder procheckbuild = new StringBuilder();
procheckbuild.Append("select name,memory from
programlar");
MyCmd.CommandText = procheckbuild.ToString();
OdbcDataReader procheck =
MyCmd.ExecuteReader(CommandBehavior.CloseConnection);
while(procheck.Read())
{
count++;
}
procheck.Close();
Process[] myproc = Process.GetProcesses();
for (int i = 0; i < myproc.Length; i++)
{
String procname = myproc.ProcessName;
for (int j = 1; j <= count; j++)
{
MyCmd = new OdbcCommand();
MyConn = new
OdbcConnection("DRIVER={MySQL ODBC 3.51
Driver};" + "SERVER=localhost;" +
"DATABASE=connector;" + "UID=root;" +
"PWD=root;");
MyConn.Open();
MyCmd.Connection = MyConn;
StringBuilder proceskontrol = new
StringBuilder();
proceskontrol.Append("select name,memory FROM
programlar where id ='");
proceskontrol.Append(j);
proceskontrol.Append("'");
MyCmd.CommandText = proceskontrol.ToString();
OdbcDataReader prochecking =
MyCmd.ExecuteReader(CommandBehavior.CloseConnection);
while (prochecking.Read())
{
String program =
prochecking.GetString(0);
String memorysize =
prochecking.GetString(1);
String dir =
@myproc.MainModule.FileName.ToString();
FileVersionInfo myinfo =
FileVersionInfo.GetVersionInfo(dir);
int memory = int.Parse(memorysize);
if
(myproc.ProcessName.Equals(program) ||
myproc.PrivateMemorySize64 == memory)
{
this.txt1.Text +=
myinfo.OriginalFilename.ToString();
}
}
MyConn.Close();
}
}
return true;
}