In some cases (I believe when inner join is used) datagridview does not represent correctly the column order populated from SQL query.
For example, I query the table columns in this order:
Select Booking_ID, Client_Name, Room_ID
although SQL return columns in correct order, however datagridview displays columns automatically in different order:
Room_ID || Booking_ID || Client_Name
The question is, how to disable this automatic column horizontal ordering, so datagridview displays the table exactly how SQL does?
I am using datasource method to fill the datagrid.
SQLDA = New SqlDataAdapter(SqlCmd)
SQLDataset = New DataSet
SQLDA.Fill(SQLDataset)
Form2.DGVData.DataSource = SQLDataset.Tables(0)
In most cases this problem is not present, and datagridview shows the table exactly as SQL does.
Thank you in advance.
PS: I would post the images but I'm not allowed since 10 reputation is required.
order byinquery,i.eSelect Booking_ID, Client_Name, Room_ID from yourTable order by Client_Name- Vivek S.SQLDA = New SqlDataAdapter(SqlCmd) SQLDataset = New DataSet SQLDA.Fill(SQLDataset) Form2.DGVData.DataSource = SQLDataset.Tables(0)- user3707554