dataGridView没有绑定数据源,这里面的列我已经自己添加了,如何把dataset里的某行数据填充进来啊?
ps:如果直接这样
DataSet ds = new DataSet();
adp.Fill(ds, "studentinfo");
dataGridView1.DataSource = ds.Tables["studentinfo"];
dataGridView就在我定义的那些列后面自动生成了表中的列,而不是把我这些列的数据填充到我自己定义的列里
谢谢各位了!
ps:如果直接这样
DataSet ds = new DataSet();
adp.Fill(ds, "studentinfo");
dataGridView1.DataSource = ds.Tables["studentinfo"];
dataGridView就在我定义的那些列后面自动生成了表中的列,而不是把我这些列的数据填充到我自己定义的列里
谢谢各位了!
然后设置 dataGridView 的 AutoGenerateColumns 为false
最后再赋值dataGridView1.DataSource = ds.Tables["studentinfo"];