Question on DataTable.Select

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
 
C

Cor Ligthert [MVP]

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top