Solved

Edit Records from DBGrid

Posted on 2002-07-10
3
238 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Working this component WebCopy with proxy, help 3 76
delphi parse string to params 3 101
select query - oracle 16 95
Firemonkey webbrowser scrollbars ? 1 29
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…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…

863 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

22 Experts available now in Live!

Get 1:1 Help Now