c#2.0中datagridview有没有像datagrid中的DataBind()方法,我试过了,怎么都没有,有什么别人方法吗?请赐教,谢谢!

解决方案 »

  1.   

    WinForm直接:  dataGridView1.DataSource = ds.Tables[0].DefaultView;
    就可以了没有DataBind()的
      

  2.   

    String queryString = 
            "Select [CustomerID], [CompanyName], [Address], [City], [PostalCode], [Country] From [Customers]";
            
          // Run the query and bind the resulting DataSet
          // to the GridView control.
          DataSet ds = GetData(queryString);
          if (ds.Tables.Count > 0)
          {
            AuthorsGridView.DataSource = ds;
            AuthorsGridView.DataBind();
          }
          else
          {
            Message.Text = "Unable to connect to the database.";
          }