Click to See Complete Forum and Search --> : datagrid sorting


rgr101
May 15th, 2003, 01:20 PM
I am creating a simple message forum that allows users to enter their Name & Comments into textboxes which, when accepted, is then displayed in a datagrid.

Everything works fine except the database initially loads in ascending order (starting with record 1, 2,...). I need to display the database starting with the last record in the database. Any suggestions?

hellomadhu
May 16th, 2003, 02:53 AM
i am sure u will have a field which determines the order of messages posted.

include in the field in the order by class of ur sql for the datagrid.

something like

" select {columns} from {table} where {conditions} order by
{ur field which determines the order} desc "

hope this helps.

rgr101
May 21st, 2003, 01:14 AM
Here is my sql statement:

Me.OleDbSelectCommand1.CommandText = "SELECT Comments, [Date], ID, Name FROM Forum"

ID is my primary key which auto increments with every new entry. Where would I put "DESC"?

Thanks!

hellomadhu
May 21st, 2003, 04:39 AM
it's simple

"SELECT Comments, [Date], ID, Name FROM Forum Order by ID DESC"

that's it