Hi
I've got a TSQL view which looks like this
In my VB.Net application, I have a ComboBox which uses the above as its datasource. The reason I've used the view rather than just bind it directly to the table is because I would like the values displayed in the drop-down in the order returned from this view. It is set up like thisCode:SELECT TOP 100 PERCENT --Needed for the ORDER BY clause N.NHSReasonID ,N.Reason ,N.Notes ,N.TopValue FROM dbo.NHSReason N ORDER BY N.TopValue DESC ,N.Reason
But I can't get this to work, the values are still displayed to the user in the order of their SQL primary key value, rather than the order I specified in the ORDER BY clause. Please can anyone suggest what I could be doing wrong?Code:Dim NHSReasonAdapter As New TopManDataSetTableAdapters.NHSReasonsInOrderTableAdapter Dim NHSReasonTable As New TopManDataSet.NHSReasonsInOrderDataTable .... NHSReasonAdapter.Fill(NHSReasonTable) .... cmbNHSReason.DataSource = NHSReasonTable cmbNHSReason.DisplayMember = "Reason" cmbNHSReason.ValueMember = "NHSReasonID"
Thanks


LinkBack URL
About LinkBacks




Reply With Quote


Bookmarks