private void btnSave_Click(object sender, EventArgs e)
{
try
{
con.Close();
con.Open();
foreach (ListViewItem Itm in listView1.Items)
cmd = new MySqlCommand("INSERT into sched_tbl (Day,Coursecode,Time,room)" + " VALUE('" + Itm.SubItems[0].Text + "','" + Itm.SubItems[1].Text + "','" + Itm.SubItems[2].Text + "','" + Itm.SubItems[3].Text + "')", con);
dt = cmd.ExecuteReader();
con.Close();
MessageBox.Show("good");
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
}
con.Close();
}
It work but my problems is only the first item is saved in my database..
I need help.. thanks :(