我在DATAGRID1中写了如下代码:
//创建DataGridCell
dgc = new DataGridCell();
dgc = this.dataGrid1.CurrentCell;
//为@EmployeeID附值
string @EmployeeID = this.dataGrid1[dgc.RowNumber,dgc.ColumnNumber].ToString();
//创建DATASET并填充数据
dataSet = new DataSet();
sqlCon.Open();
sqlDataAdapter = new SqlDataAdapter("select * from EmployeeTerritories where EmployeeID = '"+@EmployeeID+"'",sqlCon);
dataTable = new DataTable("EmployeeTerritories");
dataSet.Tables.Add("EmployeeTerritories");
sqlDataAdapter.Fill(dataSet,"EmployeeTerritories");
this.dataGrid2.DataSource = dataSet;
sqlCon.Close();
我在点击了DATAGRID1中的相应单元格后DATAGRID2中没有任何反映,这是怎么会事啊??这是一个点击DATAGRID1中相应单元格后在DATAGRID2中显示与另外一帐表中与点击的值相关联的信息!