Guest User

Guest User

  • Tech Writer
  • 529
  • 41.2k

radiobutton and texbox value save and delete Help Need

Jun 29 2021 3:30 PM

radiobutton1 = textbox1

radiobutton2 = textbox2

radiobutton3 = textbox3

 

if I Will select radiobutton1 = textbox1 value save than delete radiobutton2 = textbox2,radiobutton3 = textbox3 value delete

if I Will select radiobutton2 = textbox2 value save than delete radiobutton1 = textbox1,radiobutton3 = textbox3 value delete

if I Will select radiobutton3 = textbox3 value save than delete radiobutton1 = textbox1,radiobutton2 = textbox2 value delete

 

cmd = new SqlCommand(@"IF (SELECT COUNT(LATEFEE) FROM [DBO].[tbl_gen]) >0      
                BEGIN                  
                UPDATE tbl_gen SET LATEFEE = @latefee, A1= @a1  ,A2=@a2
                END                 
                ELSE                  
                BEGIN        
                INSERT INTO tbl_gen(LATEFEE,A1,A2) VALUES (@latefee,@a1,@a2)       
                END", sqlcon);
                sqlcon.Open();
                cmd.Parameters.AddWithValue("@latefee", textBox1.Text);
                cmd.Parameters.AddWithValue("@a1", textBox2.Text);
                cmd.Parameters.AddWithValue("@a2", textBox3.Text);
                cmd.ExecuteNonQuery();
                sqlcon.Close();
                MessageBox.Show("Record Inserted Successfully");


Answers (2)