I would recommend you use SQL parameter instead of building an SQL string but...As requested:
if (cn.State == ConnectionState.Closed) cn.Open();
cm = new SqlCommand();
cm.Connection = cn;
foreach (ListViewItem item in listView1.Items)
{
string sql = "UPDATE " + item.SubItems[2].Text + " SET [itemcount]= " + item.SubItems[1].Text + " WHERE [itemcode]= " + item.SubItems[0].Text + " AND [itemcount] IS NOT NULL";
cm.CommandText = sql;
cm.ExecuteNonQuery();
}