none
,怎么判断数据库里面一个经理下面没有一个普通员工啦! RRS feed

  • 问题

  •         {
                conn.Open();
                StringBuilder sb = new StringBuilder();
                Console.WriteLine("请输入需要删除的经理ID");
                string a = Console.ReadLine();
                sb.AppendLine("select h.* from (select j.clossID,shuname,gongzhi,ID,shunname,diexing,tianshu,rxing from jingli j inner join yougong y on(j.clossID = y.clossID) where j.clossID ='" + a + "')h");
                SqlCommand comm = new SqlCommand(sb.ToString(), conn);
                SqlDataReader aac = comm.ExecuteReader();
                int aa = comm.ExecuteNonQuery();

                while(aac.Read())
                {
                    if (aac["ID"]==null)
                    {
                        sb.AppendLine("delete from jingli where clossID ='" + a + "'");
                    }
                }
               
                if (aa == -1)
                {
                    Console.WriteLine("删除错误");
                }
                else
                {
                    Console.WriteLine("删除成功");
                }
                conn.Close();
            }

    ,怎么判断数据库里面一个经理下面没有普通员工啦!

    大家帮帮忙!!!谢谢!

    2012年12月23日 6:33