DataRelation问题
SqlConnection cn = new SqlConnection(cnStr);ds = new DataSet();
string sqlStr = "SELECT yxdm, yxmc FROM jc_jgb order by yxdm";
myDataAdapter = new SqlDataAdapter(sqlStr, cn);
myDataAdapter.Fill(ds, "jc_jgb");
sqlStr = "SELECT yxdm,jcbh,jcmc,zz,dj FROM jc_kcb order by yxdm,jcmc ";
myDataAdapter = new SqlDataAdapter(sqlStr, cn);
myDataAdapter.Fill(ds, "jc_kcb");
sqlStr = "SELECT yxdm,zydm,zymc,xz FROM jc_zyb order by yxdm,zydm ";
myDataAdapter = new SqlDataAdapter(sqlStr, cn);
myDataAdapter.Fill(ds, "jc_zyb");
//DataColumn parentColumn = ds.Tables["jc_jgb"].Columns["yxdm"];
//DataColumn childColumn = ds.Tables["jc_kcb"].Columns["yxdm"];
//创建关系
DataRelation rel_jg_jc = new DataRelation("jg_jc", ds.Tables["jc_jgb"].Columns["yxdm"], ds.Tables["jc_kcb"].Columns["yxdm"]);
// 添加关系到dataset
ds.Relations.Add(rel_jg_jc);
DataRelation rel_jg_zy = new DataRelation("jg_zy", ds.Tables["jc_jgb"].Columns["yxdm"], ds.Tables["jc_zyb"].Columns["yxdm"]);
// 添加关系到dataset
ds.Relations.Add(rel_jg_zy);
// 将数据集中的Customers表绑定到DataGrid控件上
dataGridView2.DataSource = ds.Tables["jc_jgb"].DefaultView;
dataGridView3.DataSource = ds.Tables["jc_jgb"].DefaultView;
dataGridView3.DataMember = rel_jg_jc.ToString();
dataGridView4.DataSource = ds.Tables["jc_jgb"].DefaultView;
dataGridView4.DataMember = rel_jg_zy.ToString();
请问红色那两句中的绿色的字段是什么来的,怎样定义的?为什么改了它之后就运行出错,谢谢!