DataSet ds=clientPrint.GetOrder(User.UserName,User.UserPass);
dgOrder.DataSource = ds.Tables[0].DefaultView;
像如果是WebForm的话我只要在DataGrid的模版中改就可以了
但是WinForm的我实在不知道在哪里改比如我有数据User  Pass   Name
Admin 123    小张我要绑定后为
用户名  密码   姓名
Admin  123   小张而我现在绑定的话只能为上面的那种样式谢谢   

解决方案 »

  1.   

    你用的是1.1?好像有个columncollection的属性,在里面设
      

  2.   

    RE:找不到 columncollection 这个属性还有比如数据库里面有一个字段为 0 1 我想在DataGrid中用CheckBox来表示要怎么表示啊感觉WinForm的好麻烦啊 用WebForm就简单得多了
      

  3.   

    vs2005 应该用datagridview了
                SqlConnection Conn = new SqlConnection();
                Conn.ConnectionString = "server=(local);Database=test;uid=sa;pwd=test";
                Conn.Open();
                DataSet ds = new DataSet();
                SqlDataAdapter DP = new SqlDataAdapter("select top 10 * from table", Conn);
                DP.Fill(ds, "table");
                DP.Dispose();
                Conn.Close();
                Conn.Dispose();             
                ds.Tables[0].DefaultView.AllowDelete = true;
                dataGridView1.AutoGenerateColumns = false;
                DataGridViewTextBoxColumn colName = new DataGridViewTextBoxColumn();
                colName.Name = "PKID";
                colName.HeaderText = "PKID";
                colName.DataPropertyName = "PKID";
                this.dataGridView1.Columns.Add(colName);            DataGridViewTextBoxColumn colName1 = new DataGridViewTextBoxColumn();
                colName1.Name = "SALES";
                colName1.HeaderText = "SALES";
                colName1.DataPropertyName = "SALES";
                this.dataGridView1.Columns.Add(colName1);            dataGridView1.DataSource = ds.Tables[0];//.DefaultView;//设置DataGrid的数据源