Solved

Delphi and ADO

Posted on 2002-04-17
9
162 Views
Last Modified: 2010-04-04
I have created Delphi5 MDI app that uses access2000 database. Experiencing problem when opeing tables.

I have two forms Form1 and Form2 both of which open table1 in their formcreate event and close table1 in their formclose event. problem is the table open statements don't open two separate and independent instances of the table such that when one form closes the single instance of the table closes thus affecting the other form that is still open. is this supppose to happen? how can I prevent this or work arond it?
0
Comment
Question by:mem100
  • 3
  • 2
  • 2
  • +2
9 Comments
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6948489
do you have a tadotable on each form?
0
 
LVL 1

Expert Comment

by:coondog091800
ID: 6948851
I tried the same thing and found the following:  If you put an ADOTABLE on each form and a DATASOURCE on each form and connect each ADOTABLE to the database throught the CONNECTION STRING property in the object inspector rather than connecting them through the ADOConnection it works fine.
0
 

Author Comment

by:mem100
ID: 6950364
I have a ADO connection object through which all the tables use. The ado connection object and adotables are all on a datamodule.
ideally I would like to leave this arrange as is and not put the tables on the individual forms.is there anyway to fix this without having to do away with my datamodule.
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 27

Expert Comment

by:kretzschmar
ID: 6950414
well, if your two forms accesses the same adotable-component through the datamodule then you never have a second instance.

if so, then copy the adotable in the datamodule,
and let one form go through the copied component

meikl ;-)
0
 

Author Comment

by:mem100
ID: 6951370
meikl

I had already tried what you suggested so I know it works but it means that if I have 5 forms that use the same table and all the forms can be launch simultaneously(MDI app) then I would have to get five different copies of the same table to prevent the forms for interfering with each other. Doesn't make a lot of sense to me. there must be another way. I'll leave the question open a little  longer
0
 
LVL 27

Expert Comment

by:kretzschmar
ID: 6951468
well, i usual place the table on the form,
if i wish that the form uses its own(ed) instance
and let only public database-components in the datamodule

if you want avoid this,
then you've to ensure before closing the table,
that no other form will uses this.

this could be done by a usage-counter

meikl ;-)
0
 
LVL 4

Accepted Solution

by:
nestorua earned 50 total points
ID: 6951788
HI, mem100,
If you want to use only one table, you could simply check
if the table was opened already.
As for closing you can do as COM do: create some variable that
remember how many forms using the specified table are opened.
Then when it closes decrease this variable by one.
When it becomes zero - close the table.
That's all.
Sincerely,
Nestorua.
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6975791
This question is reasonably current, but others below are not and need your attention.  ADMINISTRATION WILL BE CONTACTING YOU SHORTLY.  Moderators Computer101 or Netminder will return to finalize these if they are still open in 14 days.  Experts, please post closing recommendations before that time.

Below are your open questions as of today.  Questions which have been inactive for 21 days or longer are considered to be abandoned and for those, your options are:
1. Accept a Comment As Answer (use the button next to the Expert's name).
2. Close the question if the information was not useful to you, but may help others. You must tell the participants why you wish to do this, and allow for Expert response.  This choice will include a refund to you, and will move this question to our PAQ (Previously Asked Question) database.  If you found information outside this question thread, please add it.
3. Ask Community Support to help split points between participating experts, or just comment here with details and we'll respond with the process.
4. Delete the question (if it has no potential value for others).
   --> Post comments for expert of your intention to delete and why
   --> YOU CANNOT DELETE A QUESTION with comments; special handling by a Moderator is required.

For special handling needs, please post a zero point question in the link below and include the URL (question QID/link) that it regards with details.
http://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
 
Please click this link for Help Desk, Guidelines/Member Agreement and the Question/Answer process.  http://www.experts-exchange.com/jsp/cmtyHelpDesk.jsp

Click you Member Profile to view your question history and please keep them updated. If you are a KnowledgePro user, use the Power Search option to find them.  

Questions which are LOCKED with a Proposed Answer but do not help you, should be rejected with comments added.  When you grade the question less than an A, please comment as to why.  This helps all involved, as well as others who may access this item in the future.  PLEASE DO NOT AWARD POINTS TO ME.

To view your open questions, please click the following link(s) and keep them all current with updates.
http://www.experts-exchange.com/questions/Q.20092492.html
http://www.experts-exchange.com/questions/Q.20131576.html
http://www.experts-exchange.com/questions/Q.20171160.html
http://www.experts-exchange.com/questions/Q.20183941.html
http://www.experts-exchange.com/questions/Q.20197628.html
http://www.experts-exchange.com/questions/Q.20250861.html
http://www.experts-exchange.com/questions/Q.20254701.html
http://www.experts-exchange.com/questions/Q.20266317.html
http://www.experts-exchange.com/questions/Q.20290582.html



*****  E X P E R T S    P L E A S E  ******  Leave your closing recommendations.
If you are interested in the cleanup effort, please click this link
http://www.experts-exchange.com/jsp/qManageQuestion.jsp?ta=commspt&qid=20274643 
POINTS FOR EXPERTS awaiting comments are listed in the link below
http://www.experts-exchange.com/commspt/Q.20277028.html
 
Moderators will finalize this question if in @14 days Asker has not responded.  This will be moved to the PAQ (Previously Asked Questions) at zero points, deleted or awarded.
 
Thanks everyone.
Moondancer
Moderator @ Experts Exchange
0
 
LVL 1

Expert Comment

by:Moondancer
ID: 6978757
Thank you for returing and finalizing your open questions.
:) Moondancer - EE Moderator
0

Featured Post

Independent Software Vendors: 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

Introduction The parallel port is a very commonly known port, it was widely used to connect a printer to the PC, if you look at the back of your computer, for those who don't have newer computers, there will be a port with 25 pins and a small print…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
In a recent question (https://www.experts-exchange.com/questions/29004105/Run-AutoHotkey-script-directly-from-Notepad.html) here at Experts Exchange, a member asked how to run an AutoHotkey script (.AHK) directly from Notepad++ (aka NPP). This video…

713 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