private void lstCourse_ItemSelectionChanged(object sender, ListViewItemSelectionChangedEventArgs e)
{
int i = this.lstCourse.SelectedIndices[0];
string str = this.lstCourse.SelectedItems[0].SubItems[i].Tag.ToString();
MessageBox.Show(str);
int id ;
if (str.Equals("应用电子2001级1班"))
id = 1;
else if (str.Equals("Java"))
id = 2;
sql = "select * from Score where subjectId = "+id;
objdataset = da.ExecuteSqlQuery(sql);
this.dtgCourse.DataSource = objdataset.Tables[0];
}
请帮我看一下这段代码,str总是获取不到值,谢谢!