Question on DataTable.Select

  • Thread starter Thread starter Wan
  • Start date Start date
W

Wan

Hi,
I have a test project which contains two simple forms - 1st form
contains datagrid and couple of buttons. First button to populate the
grid with Northwind.Customers records and show 3 columns - CustomerID
|CompanyName| ContactName - works fine.

2nd button to bring up the second form contains a datagrid with
customer records with no sorting or order by. The problem is that when
I select one of the customer records and try to show the selected
record back to the 1st form in the datagrid as:

DataGrid.DataSource = DataSet1.Tables(0).Select("CustomerID = '" +
sCustID + "'")

the Order of the columns in datagrid changes to - ContactName
|CompanyName | CustomerID. Any ideas?

Regards,
Wan
 
Wan,

If you are using the DataGrid than don't use the Select for that.

Use the DataView or and a new Dataview, with what you can represent the data
in another way

As extra it keeps the rownumber in tact if the user sorts that datagrid by
clicking on top.

Cor
 
Back
Top