标题:求 大神 指点 逻辑错哪 了?????????????????????
取消只看楼主
xushengsheng
Rank: 1
等 级:新手上路
帖 子:8
专家分:0
注 册:2013-3-22
结帖率:100%
已结贴  问题点数:20 回复次数:0 
求 大神 指点 逻辑错哪 了?????????????????????
public void ShowGrade()
        {
            try
            {
                Console.WriteLine("请输入要插入年级号:");
                string gradeNo = Console.ReadLine();
                Console.WriteLine("请输入要插入名称:");
                string gradename = Console.ReadLine();
                int reed = dbo.InsertGrade(gradename, gradeNo);
                if (reed == -1)
                {
                    Console.WriteLine("数据库操作出现异常!");
                }
                else
                {
                    Console.WriteLine("插入成功!\n年级号:{0}年级名称:{1}", gradeNo, gradename);
                    Console.WriteLine("是否继续增加年级记录?\n输入Y继续,输入N退出并返回菜单");
                    char ch = Console.ReadKey().KeyChar;
                    try
                    {
                        Console.WriteLine(Convert.ToInt32(ch));
                        return;
                    if(Convert.ToInt32(ch)==78)
                    {
                        ShowMenu();
                    }
                    else if (Convert.ToInt32(ch) == 89)
                    {
                        ShowGrade();
                    }
                    else
                    {
                        Console.WriteLine("请输入Y或N!");
                    }
                    }
                    catch
                    {
                        Console.WriteLine("异常");
                    }
                }
            }
            catch
            {
                Console.WriteLine("插入失败!");
            }
        }



为什么调用别的功能以后还显示 Y或N
为什么输入键盘上的任意键他都返回菜单
搜索更多相关主题的帖子: void 异常 数据库操作 public 
2013-03-26 15:56



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-401966-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.241044 second(s), 8 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved