什么意思?代码中有四句  MessageBox.Show("成功"); 

解决方案 »

  1.   

    this.radioButton4.Text 
    换成 radioButton.SelectedItems.Text呢
      

  2.   

    radioButton是不包含SelectedItems的定义的
      

  3.   

    楼主你的四段代码可以用下面这一段来代替       private void radioButton1_CheckedChanged(object sender, EventArgs e) 
            { 
                
                //tion = new SqlConnection("server=.;database=ddt;uid=sa;pwd="); 
                sql = "select * from name where name='"+ (sender as RadioButton).Text+"'";             try 
                { 
                    tion.Open(); 
                    and = new SqlCommand(sql, tion); 
                    rd = and.ExecuteReader(); 
                    if (rd.Read()) 
                    { 
                        MessageBox.Show("成功"); 
                        sum = sum + 25; 
                    } 
                } 
                catch (SqlException ex) 
                { 
                    MessageBox.Show(ex.Message); 
                } 
                finally { 
                    tion.Close(); 
                    rd.Close(); 
                    and.Dispose(); 
                } 
            }