
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");
Guest UserPosted Jun 29, 2021, 5:31 PM
i will select radiobutton than textbox value save
i will save 20 value insert in to latefee and A1,A2 value 0
i will save 40 value insert in to A1 and latefee,A2 value 0
i will save 50 value insert in to A2 and latefee,A1 value 0
Salman BegPosted Jun 29, 2021, 5:10 PM