|
Log in |
FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
Thread Tools | Display Modes |
#1
|
|||
|
|||
NexusDB Thread Example
I have been working several days trying to write a test program using
TThread and NexusDB. I am using C++ Builder 6. I am so confused that I am not sure I can ask an intelligent question. I am trying to use a customer class (not a TForm) and a TThread class. I need to TThread to make an sql query to the database then make the query available to the customer class. This customer class will then retrieve the data from the query and update a customer form (TForm ) if necessary or provide customer data to other classes. I think I understand how to use Synchronize to update and existing TForm. However, I cannot determine how to update a class which has been created dynamically. I am not asking someone to write the code for me, I am just hoping someone has a simple example from which I can build on. I can read a little pascal so a Delphi example will be also be welcomed. Thanks in advance for your help. |
#2
|
|||
|
|||
Re: NexusDB Thread Example
Before I run off in the wrong direction, might I ask what type of problem
you are trying to solve by using a TThread? -- Eivind Bakkestuen [NDD] Please, no email unless requested. Search Borland and third-party newsgroups here: www.tamaracka.com "William E. Mahaffey" <wmahaffeyREMOVECAPS@PLEASEsuziessoftware.com> wrote in message news:3f6890c1@wic040d.... > I have been working several days trying to write a test program using > TThread and NexusDB. I am using C++ Builder 6. I am so confused that I am |
#3
|
|||
|
|||
Re: NexusDB Thread Example
Eivind,
I have a multi-user Job Tracking program that I wrote about 3 years ago using FlashFiler. To make a long story short I need to upgrade it and move to NexusDB. One of the user requests is to allow multiple copies of different modules to run simultaneously. For instance the user may need to look at multiple customer records and/or multiple job records and/or multiple inventory records at the same time. This means that I will have to provide the capability of multiple customer, job and inventory forms to be displayed at the same time. The open jobs may not be for the same customers that are open. My Idea about how to handle that would be to design customer, job and inventory classes that were independent of the forms and let each customer, job or inventory session have it's own thread to access the database. Do I need threads here, or can I just dynamically create a session, database, table and query for each class that I create. Thanks so very much for your help. William |
#4
|
|||
|
|||
Re: NexusDB Thread Example
> Do I need threads here, or can I just dynamically create a session,
database, table and query for each class that I create. Threads are not really necessary to solve this problem. Just create the components dynamically for the different views. Terry |
#5
|
|||
|
|||
Re: NexusDB Thread Example
"William E. Mahaffey" <wmahaffeyREMOVECAPS@PLEASEsuziessoftware.com> wrote
in <3f689b63@wic040d.>: > Do I need threads here, or can I just dynamically create a session, > database, table and query for each class that I create. > Drop your session and table components on the form. Then simply create the form in code using: Application->CreateForm(__classid(TMyForm), &AFormPointer); Since the component are on the form. Each form will work independently from each other. Don't forget to remove it from the active form in project option-> Forms Also I would recommend that you create a TList to keep track of the form (pointers) you created at runtime so you can destroy them gracefully when you exit the program. Or simplier than that code your OnClose event to call Delete this; so that when the user close the form it's deleted Best Luck -- Regards from Quebec. David Charron |
#6
|
|||
|
|||
Re: NexusDB Thread Example
David and Terry,
Thank you so very much for your help. William |
#7
|
|||
|
|||
Re: NexusDB Thread Example
If you use the method describe of cleaning up your form by calling "Delete
this" you will end up having problems as it will free the memory for the form as soon as it is called. A better way to is to call the Release() ; method of the form which allows the proper processing to take place. From the Help: Description Use Release to destroy the form and free its associated memory. Release does not destroy the form until all event handlers of the form and event handlers of components on the form have finished executing. Release also guarantees that all messages in the form's event queue are processed before the form is released. Any event handlers for the form or its children should use Release. Failing to do so can cause a memory access error. Note: Release returns immediately to the caller. It does not wait for the form to be freed before returning. "William E. Mahaffey" <wmahaffeyREMOVECAPS@PLEASEsuziessoftware.com> wrote in message news:3f68a99f@wic040d.... > David and Terry, > > Thank you so very much for your help. > > William > > |
#8
|
|||
|
|||
Re: NexusDB Thread Example
Also another method is to set the CloseAction parameter on the OnClose event
of a form. Simply put in the line: Action = caFree ; "William E. Mahaffey" <wmahaffeyREMOVECAPS@PLEASEsuziessoftware.com> wrote in message news:3f68a99f@wic040d.... > David and Terry, > > Thank you so very much for your help. > > William > > |
#9
|
|||
|
|||
Re: NexusDB Thread Example
William,
Just a shot in the dark...Is it possible to use memory tables? The user's interface speed would be incredible even with many different customer accounts open simultaneously! John William E. Mahaffey wrote: > David and Terry, > > Thank you so very much for your help. > > William > > > |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
How to create a different session in diff thread: | Marc Pike | nexusdb.public.support.sql | 1 | 3rd August 2005 12:24 PM |