I want to add 3 text boxes values in single table at one time...For this purpose i m using for loop but its giving me eror after inserting first value that the cant update or add the child row...what should i do now....my query is given below.
TextBox[] textBoxes = new TextBox[] { textBox5, textBox6,textBox7 };
try
{
for (int i = 1; i <=3; i++)
{
cmd = connection.CreateCommand();
cmd.CommandText = "INSERT INTO RequirementSkill(ReqSkillName,fk_ReqID)VALUES(@ReqSkillName,LAST_INSERT_ID())";
cmd.Parameters.AddWithValue("@ReqSkillName", textBoxes[i].Text);
cmd.ExecuteNonQuery();
cmd.Parameters.Clear();
}
}
catch (Exception)
{
throw;
}