string sqlstr = " and  Co_Dept_ID = '"+this.cmb_Dept.SelectedValue.ToString()+"'";
DataSet ds = pClass.QueryPostData(sqlstr);//查询表的内容
CreateStyles(DtGrid_Post);//设定DataGrid的格式 (DtGrid_Post)
this.DtGrid_Post.SetDataBinding(ds,"Co_post");
//出现无法创建字段“Co_post”的子列表
请问是怎么回事

解决方案 »

  1.   

    改成:
    this.DtGrid_Post.SetDataBinding(ds.Tables[0]);
      

  2.   

    change
    CreateStyles(DtGrid_Post);//设定DataGrid的格式 (DtGrid_Post)
    this.DtGrid_Post.SetDataBinding(ds,"Co_post");with
    this.DtGrid_Post.SetDataBinding(ds,"Co_post");
    CreateStyles(DtGrid_Post);//设定DataGrid的格式 (DtGrid_Post)
      

  3.   

    或者:
    this.DtGrid_Post.DataSource = ds.Tables[0];
      

  4.   

    设定DataGrid的格式和绑定数据有什么好的方法不
      

  5.   

    this.DtGrid_Post.DataSource = dt;//设定DataGrid的数据源就不能改变格式了,有没有什么办法