Andrew

Andrew

  • NA
  • 17
  • 0

How to bind a datagridview.

Apr 28 2008 4:02 AM

I have a datagrid view in my C# app and I want to know how to use a BindingSource (Toolbox -> Data -> Binding Source) to use the controls to filter/sort/etc the data.

Here is the current code:

 

[code]

SqlCommand all = new SqlCommand("select * from TableIndex where DespatchMethod = 'WORLD MAIL'", conn);

SqlDataAdapter adpt = new SqlDataAdapter(all);

DataSet ds = new DataSet();

adpt.Fill(ds);

dgvCompanies.DataSource = ds.Tables[0];

[/conn]

Any help is appreciated. Cheers


Answers (2)