Solved

Edit Records from DBGrid

Posted on 2002-07-10
3
237 Views
Last Modified: 2010-04-04
Im just new in Delphi Programming so I hope somebody could help me with this. How do I link a DBEdit box and combobox to a DBGrid columns(which is connected to a database) so as when I click a record from the dbgrid I can edit or delete that record using the editbox, combobox and command buttons. I also need to add records by clicking an ADD button and the type the the data in the edit boxes and combo boxes. And also, I want to restrict the user to type anything in the DBGrid, I want all editing in the editboxes, how do I do this? Hope somebody could help me. Thanks.
0
Comment
Question by:sharol
  • 2
3 Comments
 
LVL 27

Accepted Solution

by:
kretzschmar earned 150 total points
ID: 7145162
use the same datasource for the grid and your dbedits,
set the grid readonly (property)

you could use three buttons

edit-method=datasource1.dataset.edit;
new-method=datasource1.dataset.insert; //or append

//following is only available, if edited or new
save-method=datasource1.dataset.post;
maybe-cancel-method=datasource1.dataset.cancel;

you could also use a tdbnavigator for this
(just connect it to the same datasource)

hope this helps

meikl ;-)

0
 

Author Comment

by:sharol
ID: 7145287
is this also possible if the list/items of the combo box is coming from another table?
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 7148641
yes,

you could use a tdbcombobox or a tdblookupcombobox

by the tdbcombobox you've to fill the entries at appstart

meikl ;-)
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

A lot of questions regard threads in Delphi.   One of the more specific questions is how to show progress of the thread.   Updating a progressbar from inside a thread is a mistake. A solution to this would be to send a synchronized message to the…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…
Access reports are powerful and flexible. Learn how to create a query and then a grouped report using the wizard. Modify the report design after the wizard is done to make it look better. There will be another video to explain how to put the final p…

758 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now