Sorting Columns

Morn

Active member
Joined
Dec 4, 2006
Messages
40
Programming Experience
Beginner
All I want to do is get the first column from the grid created below to be in the format of last booking ref first. Can I find the resource on the web? No i can't!

Any one??

VB.NET:
SELECTS ALL BOOKINGS THAT RELATE TO THE CUSTOMER NUMBER
        Dim da3 As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("SELECT tblBooking.[bookingID], tblBooking.[traveldate], tbldestination.[destinationname], tblBooking.[duration] FROM tblBooking, tblDestination WHERE tblBooking.[destinationID] = tblDestination.[destinationID] AND [customerID] =" & customerref, myConnection)
        Dim ds3 As DataSet = New DataSet()
        da3.Fill(ds3, "holidaydetails")
        DataGridView3.DataSource = ds3.Tables("holidaydetails")
        With Me.DataGridView3
            .Columns(0).HeaderText = "Booking ID:"
            .Columns(1).HeaderText = "Travel Date:"
            .Columns(2).HeaderText = "Destination:"
            .Columns(3).HeaderText = "Duration:"
        End With
        'END SELECT
'
 
You need to add "Order By tblBooking.[BookingID] DESC" to the end of your SQL. This will put the record list in a descending (DESC) order which would show you the most recent added record first.
 
I hope I understand it correctly. Try this one:

VB.NET:
Dim da3 As OleDb.OleDbDataAdapter = New OleDb.OleDbDataAdapter("SELECT tblBooking.[bookingID], tblBooking.[traveldate], tbldestination.[destinationname], tblBooking.[duration] FROM tblBooking, tblDestination WHERE tblBooking.[destinationID] = tblDestination.[destinationID] AND [customerID] =" & customerref & " ORDER BY tblBooking.[bookingID] DESC", myConnection)
 
That's the one, i got that myself turns out that it was how to put it in to the statement that got me.

Thanks for that guys
 
Back
Top