Im currently working now into a monitoring system


Adodc2.Recordset.AddNew
Adodc2.Recordset!employeeNumber = txtNumber.Text
Adodc2.Recordset.update


now i've noticed that after i input a value and save it. it goes to the bottom of the datagrid, how can i add value in the top of the datagrid? Thanks for the reply in advance

Recommended Answers

All 6 Replies

How are you populating the data grid ?

i just keep informations like
employee number
employee name
and employee position using this code

im using adodc and datagrid

Adodc1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\database.mdb;Persist Security Info=False"
Adodc1.RecordSource = "Select * from employee"
Set DataGrid1.DataSource = Adodc1
Adodc1.Refresh

the above code is placed in form load

and the code below is place in a command button

Adodc2.Recordset.AddNew
Adodc2.Recordset!employeeNumber = txtNumber.Text
Adodc2.Recordset.update

but the latest record that i've input using this code goes to the bottom of the datagrid/ database.mdb, i need it ontop of the datagrid

Do you have any field in your table that stores transaction time ?

If yes, sort by descending order on that field.

I'd already tired that, it also works, but I prefer for the adding in top of the datagrid/ database if there is any code that can do that, thanks for you help Sir, really appreciate it :)

When data is stored in a database, physical position is not at all important and the user has hardly any control over the.
No code can do that for you.
You can only display that at the top.

okay sir, thanks :)
i've decided to use the order by method in SQL coding

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.