首页 新闻 会员 周边 捐助

调试时断点起不了作用

0
悬赏园豆:5 [待解决问题]


    class YC
    {
        private string Message;
        public YC()
        {

            this.Message = "输入有误,请重新输入";
        }

        public override string ToString()
        {
            return Message;
        }

    }

    public partial class Form2 : Form
    {
        public Form2()
        {
            InitializeComponent();
        }

        private void button1_Click(object sender, EventArgs e)
        {

            try
            {
                string a = textBox1.Text;

                int result;

                bool bl = int.TryParse(textBox2.Text, out  result);

                if (!bl)
                {
                    throw new YC();
                }
                else
                {
                    int b = int.Parse(textBox2.Text);
                    bool bl1 = ceshi(a, b);

                    if (bl1)
                    {
                        MessageBox.Show("CHENGONG");
                    }
                    else
                    {
                        MessageBox.Show("SH");
                    }

                }
            }

            catch (YC yc)
            {
                MessageBox.Show(yc.Message);
            }
            //string a = textBox1.Text;
            //int b= int.Parse(textBox2.Text);
            //bool bl = ceshi(a, b);
            //if (bl)
            //{
            //    MessageBox.Show("CHENGGONG");

            //}
            //else
            //{

            //    MessageBox.Show("SHIBAI");

            //}
            finally
            {

            }
     
        }

 

 

 

 

 

        public bool ceshi(string a, int b)
        {
            string connectionstring = "server=localhost;database=ceshi;integrated security=SSPI";
            SqlConnection con = new SqlConnection(connectionstring);
            con.Open();
            //string commandtext = "select * from Table_1 where name='" + a + "'and passward=" + b;
            //string @name;
            //string @passward;
            string commandtext = "select * from Table_1 where name=@nameand passward = @passward";

            SqlCommand cmd = new SqlCommand(commandtext, con);
            //cmd.Parameters.Add("@name", SqlDbType.VarChar);
            //cmd.Parameters["@name"].Value = "a";
            cmd.Parameters.AddWithValue("@name", a);
            cmd.Parameters.Add("@passward", SqlDbType.Int);
            cmd.Parameters["@passward"].Value = b;

            SqlDataReader reader = cmd.ExecuteReader();
            if (reader.Read())
            {
                return true;
            }
            else
            {
                return false;
            }
            con.Close();

        }
    }设置了断点之后,在调试过程中,没有逐行运行,而是直接弹出CHENGGONG,或SHIBAI结果,这段程序是Winforms程序。

870087629的主页 870087629 | 初学一级 | 园豆:170
提问于:2010-09-19 16:57
< >
分享
所有回答(2)
0

重启下编译器吧

一滴血 | 园豆:1602 (小虾三级) | 2010-09-19 17:27
0

那就说明没运行到这个断点吧?

顾晓北 | 园豆:10898 (专家六级) | 2010-09-20 09:36
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册