We help IT Professionals succeed at work.

We've partnered with Certified Experts, Carl Webster and Richard Faulkner, to bring you two Citrix podcasts. Learn about 2020 trends and get answers to your biggest Citrix questions!Listen Now

x

simple database

Medium Priority
250 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
Comment
Watch Question

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

Author

Commented:
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

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

Author

Commented:
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


Commented:
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?

Author

Commented:
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

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

Author

Commented:
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


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

Not the solution you were looking for? Getting a personalized solution is easy.

Ask the Experts

Author

Commented:
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
Access more of Experts Exchange with a free account
Thanks for using Experts Exchange.

Create a free account to continue.

Limited access with a free account allows you to:

  • View three pieces of content (articles, solutions, posts, and videos)
  • Ask the experts questions (counted toward content limit)
  • Customize your dashboard and profile

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.