A local variable named 'cmdDatabase' cannot be declared in this scope because it would give a different meaning to 'cmdDatabase',
<pre><code>namespace ConsoleApplication2
{
    class Program
    {
        static void Main(string[] args)
        {


            MySqlConnection conDatabase = new MySqlConnection("Data Source=localhost;" +
                                       "Persist Security Info=yes;" +
                                       "UserId=tee; PWD=t421039; database=ph3;");
            conDatabase.Open();
            MySqlCommand cmdDatabase = new MySqlCommand("DROP TABLE IF EXISTS `q_mem_sur`; create table q_mem_sur as SELECT Count(*) As rowa,  member.Ssurname,  Sum(Case When ((member.status = '1')) Then 1 Else 0 End) As Status11 From member Group By member.Ssurname Order By rowa Desc;", conDatabase);



     string[] arr = new string[8];       
    arr[0] = "UPDATE `member` SET `amphurecode`= SUBSTRING(member.own,3,4)";               
    arr[1] = "UPDATE `member` SET `provincecode`= SUBSTRING(member.own,3,2)";
    arr[2] = "DROP TABLE IF EXISTS `q_mem_tim`; create table q_mem_tim as SELECT member.idmember, member.own, member.provincecode, province.PROVINCE_NAME, member.amphurecode, amphur.AMPHUR_NAME, member.Sname, member.Ssurname, member.Hno, member.Moo, member.Sex, member.tambol, member.dateofbirth, member.migratedate, Year( Current_Date( ) ) -  Year( member.dateofbirth ) AS y,  DATEDIFF('2011-08-01',(migratedate)) AS d FROM member LEFT JOIN amphur ON ( member.amphurecode  = amphur.AMPHUR_CODE ) LEFT JOIN province ON member.provincecode  = province.PROVINCE_CODE";
    arr[3] = "DROP TABLE IF EXISTS `q_mem_sur`; create table q_mem_sur as SELECT Count(*) As rowa,  member.Ssurname,  Sum(Case When ((member.status = '1')) Then 1 Else 0 End) As Status11 From member Group By member.Ssurname Order By rowa Desc";
    arr[4] = "DROP TABLE IF EXISTS `q_mem_hno`;create table q_mem_hno as select member.Hno, member.Moo, member.tambol, COUNT( member.Hno ) AS cntHno, COUNT(DISTINCT member.Ssurname) as NoSur ";
    arr[5] = "DROP TABLE IF EXISTS `q_pro_ori`;create table q_pro_ori as Select member.provincecode,   count(*) As cnt  From member Group By member.provincecode Order By cnt Desc ";
    arr[6] = "DROP TABLE IF EXISTS `q_am_ori`;create table q_am_ori as Select member.amphurecode,  member.provincecode,  count(*) As cnt  From member Group By member.amphurecode, member.provincecode Order By cnt Desc ";
    arr[7] = "DROP TABLE IF EXISTS `Sur_Hno_`;create table Sur_Hno_ as SELECT count( *  ) , Ssurname, q_mem_tim.Hno, q_mem_tim.Moo, q_mem_tim.tambol FROM q_mem_tim";

    foreach (string s in arr)
    {
        Console.WriteLine(s);
        MySqlCommand cmdDatabase = new MySqlCommand((s), conDatabase);
        cmdDatabase.CommandTimeout = 500;
        cmdDatabase.ExecuteNonQuery();
    }


            conDatabase.Close();


        }
    }
}
</code></pre>
