Solved

simple database

Posted on 1997-09-28
10
212 Views
Last Modified: 2013-12-26
I am using Borland C++ 4.5

Please could someone provide me with a simple database example using a dialog box with edit boxes (not a combo box).This example should be able to read in two or three records to file and then be able to read them out again and display then one at a time in the dialog box.

many thanks

Richard
0
Comment
Question by:aa941438
[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
  • 5
  • 5
10 Comments
 
LVL 3

Expert Comment

by:msmits
ID: 1299406
What kind of database are you using or can you define your own database format? Do you have the 4.5 with the database tools?
Do you mean that you want an example where you can create a record with a few field (via entering data in the editboxes) and then navigate through them via some buttons (next, previous,...)?

0
 

Author Comment

by:aa941438
ID: 1299407
Yes, I have just installed Borland C++ 4.5 with database tools. However, I'm damned if I can find the tools!!!!!!!!! Can you point me in the right direction to where they are.

To elaborate, while I have created a few simple databases in the past this will be my first with a visual front end. My principle problem is that I don't know how to enter a series of records through the front end and read them back again. As such, I would like an example which I could work from.

Your description sounds about right. I would like an example where you can create a record by entering data into a few fields i.e.,via entering data into edit boxes (not combo), and then be able to navigate through the entered records as desired via some buttons(next, previous,...).

regards

Richard
0
 
LVL 3

Expert Comment

by:msmits
ID: 1299408
I have currently 5.02 installed, which has all the database tools integrated. They are controls in the resource workshop. I have an example plus description of how to make such an application, but only for 5.0.
I can try to install 4.5 tonight and try to recreate and check my approach on that. The code is however to large to post here. I can make it available on my ftp site.
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!

 

Author Comment

by:aa941438
ID: 1299409
Thanks for your efforts. It's most appreciated.

If your code can provide me with the information I require with respect to reading and writing records I would be very grateful if I could down-load it from your ftp site.

regards

Richard


0
 
LVL 3

Expert Comment

by:msmits
ID: 1299410
The 5.0 has droppable database controls in the resource workshop. This functionality is not in the database tools. The database tools in 4.5 is the API and tools for accessing the BDE.

Are you using some kind of existing database or must the application create the database itself? What type of database is used by the application (Access, Paradox or other) or doesn't it make any difference?

0
 

Author Comment

by:aa941438
ID: 1299411
Thanks for you message and efforts.

No I am not using an existing database. The database must be created by the application itself even though what I require is  relatively simple.

I have been exploring the possibility of installing version 5.0 on my machine but this looks rather unlikely as my machine is not currently up to the task and I don't hold out much hope in this area. I'd rather not buy a new machine if I can help it!

what do you think?

regards

Richard
0
 
LVL 3

Expert Comment

by:msmits
ID: 1299412
You need to use the BDE API functions to accomplish the task when using Borland 4.5. The BDE, its API and tools are the extra database stuff that is called 'Database Tools'.
Programming with the BDE API is not simple. The helpfile (in the doc directory of the BDE installation) provides the necessary information for programming with that API.

I have created an example application which is a dialog client with a menu. The only relevant menu action is creating the empty database.
All other elements are in the dialog. It contains two editboxes and a whole bunch of buttons for all the separate actions. The BNClicked functions for this buttons perform the necessary BDE database actions.

The basic sequence is:

  DbiInit();
  DbiOpenDatabase();
  DbiSetDirectory();
  DbiOpenTable();
  DbiGetCurProps();
   malloc for record buffer
  DbiSetToBegin();
  DbiGetNextRecord();               (n times)

  DbiCloseCursor();
  DbiCloseDatabase();
  DbiExit();

The sample application can be downloaded from the following URL:

  ftp://ftp.IAEhv.nl/pub/users/msmits/exp-exch/sdbase.zip

You need to open the sdbase.ide file with Borland C++, generate the .apx file for the ClassExpert and maybe change some paths for the include files and libraries.
Just in case the .ide file of 5.0 doesn't work, I also included the makefile sdbase.mak.

0
 

Author Comment

by:aa941438
ID: 1299413
Thanks for help, really appreciated. However, I cannot access your ftp site.

I've tried 'open IAEhv.nl' but I am requested for a name and password which I don't know.

All other combinations of the ftp address given result in 'unknown host' being flaged.

Maybe I'm missing something but it would appear I need a guest name and password. What do you think?

regards

Richard


0
 
LVL 3

Accepted Solution

by:
msmits earned 550 total points
ID: 1299414
You need to do anonymous ftp to ftp.IAEhv.nl. Which means that you can use 'ftp' (without the quotes) as username and your email address as password.
Then you can cd to the /pub/users/msmits/exp-exch directory and do a binary get of sdbase.zip.

You can also copy the full url from my previous answer and paste it in the URL or location box of Netscape or IExploder. This will do the anonymous ftp for you.

0
 

Author Comment

by:aa941438
ID: 1299415
Many thanks, I really appreciate the time and trouble you've been to. I shall now get the program to run. Even if I can't I will have got a good insight into the requirements to code a database.

many thanks again

regards

Richard
0

Featured Post

Industry Leaders: 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

Suggested Solutions

Title # Comments Views Activity
Google adds suggestions 3 77
jQuery Date picker not working 16 262
Question on web subscription for apps 3 122
JQuery tracking event. 3 89
What is Node.js? Node.js is a server side scripting language much like PHP or ASP but is used to implement the complete package of HTTP webserver and application framework. The difference is that Node.js’s execution engine is asynchronous and event…
Introduction Since I wrote the original article about Handling Date and Time in PHP and MySQL several years ago, it seemed like now was a good time to update it for object-oriented PHP.  This article does that, replacing as much as possible the pr…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…

738 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