private void button1_Click(object sender, System.EventArgs e) { listView1.Items.Clear();
for (int i=0;i< myTable.Rows.Count;i++) { this.myRow = myTable.Rows[i]; this.myTable = ds.Tables[0]; ListViewItem altem= new ListViewItem(myRow[1].ToString().Trim()); DataColumn[] keys = new DataColumn[1]; keys[0]=ds.Tables["t_tz"].Columns["t_zcbh"]; ds.Tables["t_tz"].PrimaryKey =keys; altem.SubItems.Add(myRow[1].ToString().Trim()); altem.SubItems.Add(myRow[2].ToString().Trim()); altem.SubItems.Add(myRow[3].ToString().Trim()); altem.SubItems.Add(myRow[4].ToString().Trim()); altem.SubItems.Add(myRow[5].ToString().Trim()); altem.SubItems.Add(myRow[6].ToString().Trim()); altem.SubItems.Add(myRow[7].ToString().Trim()); altem.SubItems.Add(myRow[8].ToString().Trim()); altem.SubItems.Add(myRow[9].ToString().Trim()); altem.SubItems.Add(myRow[10].ToString().Trim()); altem.SubItems.Add(myRow[11].ToString().Trim()); altem.SubItems.Add(myRow[12].ToString().Trim()); altem.SubItems.Add(myRow[13].ToString().Trim()); altem.SubItems.Add(myRow[14].ToString().Trim()); listView1.Items.Add(altem); 提示:i< myTable.Rows.Count;i++) 错误,请指点下,在线等,谢谢