Solved

Handling database

Posted on 2002-07-10
12
150 Views
Last Modified: 2010-04-04
This is my first project in Delphi and I badly need some help. Can somebody help me with my data entry, editing and processing of data? 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
12 Comments
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7145331
Hello
 
  Here are some steps to make a simple database program

1. drop Table components on the form, and set the Database property to: DBDemos, and the TableName property to: Customer, then set the Active Property to: True.

2. Double Click on the Table component that on the form, u will see new window, right click on it, and choose add all fields.

3. Select all the fields, and draw them on the form, you will see the controls on the form connected to ur table, and Datasource Component.

4. From the Datacontrol Tab, drop DBNavigator on the form, and set it's DataSource Property to Datasource1

5. Run your project, you have now simple database application, and you can add, edit and delete records to the table using the DBNavigator

Best regards
Mohammed Nasman
0
 

Author Comment

by:sharol
ID: 7145342
im using apollo as my database tool. can you help me with this? I would like to make use of buttons to handle the database so that it would be user friendly.would you like to take a look t my form?
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7145442
Hello

  here's the code for add, save and delete

procedure TForm1.btnAddClick(Sender: TObject);
begin
  Table1.Append;
end;

procedure TForm1.btnSaveClick(Sender: TObject);
begin
  Table1.Post;
end;

procedure TForm1.btnDeleteClick(Sender: TObject);
begin
  if MessageDlg('Do you want to Delete this record',mtError,[mbYes,mbNo],0) = mrYes then
    Table1.Delete;
end;
0
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 7145444
if you wish also to move between records using code, look at

  Table1.Next;
  Table1.Prior;
  Table1.First;
  Table1.Last;
0
 

Author Comment

by:sharol
ID: 7155992
I am handling the database with a datasource. How do I delete records with that component? Can you provide me the code for the delete button with a messagebox so that there will be a verification before a record is deleted. I tried the code you provided but it won't work. Maybe I lack something.
And also, can you help me with my date field. I am using a dbedit for the date entry but I always get an error message that the date entered is not a valid date though for me it is. There must be something I need to declare or configure. Thanks again.
0
 
LVL 2

Expert Comment

by:mikepj
ID: 7177806
He's provided what you ask for already.  What didn't work?

What is the ShortDateFormat for your system?  That is really a seperate question.
0
 

Author Comment

by:sharol
ID: 7183135
okay, disregard the date question.

about the delete, its not working. what i am doing is i display the records in a dbgrid. qnd when the user clicks a record and then click the delte button, that record should be deleted. how do i do this? hope you could help me, please. thanks a lot.
0
 
LVL 22

Accepted Solution

by:
Mohammed Nasman earned 350 total points
ID: 7183271
Hello sharol

  the code i gave to you working fine with delete

however, when you have table that has a details, you can't delete a record from the master table and there are existing records to it in the detail table

give me ur email
and i will send you a sample application for the database, that contain most of the functions
0
 

Author Comment

by:sharol
ID: 7183466
it a_lynpm@yahoo.com. thanks a lot.

hope you could provide me with one that deals with an apollo table,datasource and a dbgrid whrein the records are displayed. thanks again. il wait for your e-mail.
0
 

Expert Comment

by:CleanupPing
ID: 9343074
sharol:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1 
EXPERTS:
Post your closing recommendations!  No comment means you don't care.
0
 
LVL 22

Expert Comment

by:Mohammed Nasman
ID: 9387919
points to me
0
 
LVL 5

Expert Comment

by:Lukasz Lach
ID: 9460846
sharol,
No comment has been added lately (12 days), so it's time to clean up this TA.
I will leave a recommendation in the Cleanup topic area for this question:

RECOMMENDATION: Award points to mnasman http:#7145331

Please leave any comments here within 7 days.

-- Please DO NOT accept this comment as an answer ! --

Thanks,

anAKiN
EE Cleanup Volunteer
0

Featured Post

Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Objective: - This article will help user in how to convert their numeric value become words. How to use 1. You can copy this code in your Unit as function 2. than you can perform your function by type this code The Code   (CODE) The Im…
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…
There are cases when e.g. an IT administrator wants to have full access and view into selected mailboxes on Exchange server, directly from his own email account in Outlook or Outlook Web Access. This proves useful when for example administrator want…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Suggested Courses
Course of the Month4 days, 21 hours left to enroll

635 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