Bob Langlade
Well-known member
- Joined
- Sep 20, 2005
- Messages
- 115
- Location
- Saint-Pierre & Miquelon Islands
- Programming Experience
- 3-5
Hi,
I am trying Link to SQL in VB 2008 as it seems a promising feature.
I have added a LinkToSql class (name Sage.dbml) to my project with all the databases in needed from my SQL Server.
I then perform this simple code to populate my datagridview :
But instead of having columns created in the order "Number, Name, MaxCredit", I get "MaxCredit, Name, Number", which looks like by selecting a LinkToSql object as datasource you automatically sort alphabetically your column header.
Any idea on how to fix that?
I am trying Link to SQL in VB 2008 as it seems a promising feature.
I have added a LinkToSql class (name Sage.dbml) to my project with all the databases in needed from my SQL Server.
I then perform this simple code to populate my datagridview :
VB.NET:
Dim Db As New SageDataContext
Db.DeferredLoadingEnabled = False
Dim Elements = From Customers In Db.F_COMPTET _
Select Number = Customers.CT_Num, Name = Customers.CT_Intitule, MaxCredit = Customers.CT_Encours _
Where (Name.Contains(TextBox1.Text))
DataGridView1.DataSource = Elements
But instead of having columns created in the order "Number, Name, MaxCredit", I get "MaxCredit, Name, Number", which looks like by selecting a LinkToSql object as datasource you automatically sort alphabetically your column header.
Any idea on how to fix that?