hi,
Firstly here is my code,,
foreach (DataGridViewRow row in gridviewterm.Rows)
{
bool isSelected = Convert.ToBoolean(row.Cells["Select_Term"].Value);
if (isSelected)
{
message += Environment.NewLine;
message = row.Cells["Term"].Value.ToString();
getterm = message;
for (int i = 0; i < checklistboxgrade.Items.Count; i++)
{
if (checklistboxgrade.GetItemChecked(i))
{
string str = (string)checklistboxgrade.Items[i]; //Or try list1.Items[i].ToString();
getselectedvalue = str;
SqlCommand cmd2 = new SqlCommand("insert into Tbl_SubSubject_Master (Class,Subject,Term,Grading_Pattern) values('" + comboClass.Text + "','" + ComboSubject.Text + "','" + getterm + "','" + getselectedvalue + "')", con0);
cmd2.CommandType = CommandType.Text;
SqlDataReader reader = null;
reader = cmd2.ExecuteReader();
reader.Close();
}
}
}
}
When i execute this code in First itteration all Works Fine But When Starts with
second Itteration it goes on for loop instead of foreach loop
i want to execute it in the same way as the 1st itteration happen