Link to home
Start Free TrialLog in
Avatar of aa941438
aa941438

asked on

simple database

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
Avatar of msmits
msmits

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,...)?

Avatar of aa941438

ASKER

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
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.
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


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?

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
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.

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


ASKER CERTIFIED SOLUTION
Avatar of msmits
msmits

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
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