datagridview数据源的绑定 一定要用DataAdapter 

解决方案 »

  1.   

    如果你的数据在dataset,直接datagridview.datasources = ds
      

  2.   

    DataGridView 类支持标准的 Windows 窗体数据绑定模型。这意味着数据源可以是实现下列接口之一的任何类型:IList 接口,包括一维数组。IListSource 接口,例如,DataTable 和 DataSet 类。IBindingList 接口,例如,BindingList 类。IBindingListView 接口,例如,BindingSource 类。
      

  3.   

     用 datareader 呢??
      

  4.   

    SqlDataReader   sdr   =   cmd.ExecuteReader(); 
    BindingSource   bs   =   new   BindingSource(); 
    bs.DataSource   =   sdr; 
    this.dataGridView1.DataSource   =   bs; 
      

  5.   

     是不是用适配器 都不用打开关闭 connection啊
      

  6.   

    我的意思是写数据库操作的时候用DATAADAPTER 用不用打开connection连接和关闭连接