Solved

Edit Records from DBGrid

Posted on 2002-07-10
3
243 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Want Experts Exchange at your fingertips?

With Experts Exchange’s latest app release, you can now experience our most recent features, updates, and the same community interface while on-the-go. Download our latest app release at the Android or Apple stores today!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to create forms/units independent of other forms/units object names in a delphi project. Have you ever created a form for user input in a Delphi project and then had the need to have that same form in a other Delphi proj…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
In this video, Percona Solutions Engineer Barrett Chambers discusses some of the basic syntax differences between MySQL and MongoDB. To learn more check out our webinar on MongoDB administration for MySQL DBA: https://www.percona.com/resources/we…
Suggested Courses
Course of the Month2 days, 18 hours left to enroll

621 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