[此贴子已经被作者于2006-11-20 21:53:10编辑过]
问题解决了可是在DATAGRID1中点击了之后DATAGRID2中却不显示,只有把他写到按钮事件中才会显示,代码如下:
//创建DataGridCell
dgc = new DataGridCell();
dgc = this.dataGrid1.CurrentCell;
//为@EmployeeID附值
string @EmployeeID = this.dataGrid1[dgc.RowNumber,dgc.ColumnNumber].ToString();
//创建DATASET并填充数据
dataSet = new DataSet();
sqlDataAdapter = new SqlDataAdapter("select * from EmployeeTerritories where EmployeeID = '"+@EmployeeID+"'",sqlCon);
dataTable = new DataTable("EmployeeTerritories");
dataSet.Tables.Add("EmployeeTerritories");
sqlDataAdapter.Fill(dataSet,"EmployeeTerritories");
this.dataGrid2.SetDataBinding(dataSet,"EmployeeTerritories");
这个事件是写在DATAGRID1中的