Hello everyone,
I'm new in the world of Delphi and Pascal, so I could use your help. Here's my first question:
I use Delphi7 and I have a DBGrid that is populated with one hundred records.
I run the query to refresh the content of the dbgrid after each new record that I insert into the database table, and i would like to know how to display the bottom of it. By default it displays the top of it.

The DBGrid is populated from a query, just use the "order" clause in the query when calling the dataset.

E.g. Select StudentID, StudentName, StudentClass From Table_Students Order By StudentID desc

I am very thankful for sharing your knowledge with me, but I already found a solution for my question :

myquery.sql.text:='select * from Table_Students ';
myquery.open;
myquery.last

The code 'myquery.last' will position the DBgrid to the bottom record.
And vice versa,

myquery.first;

would position the dbgrid to the top record.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.