Solved

Delphi and ADO

Posted on 2002-04-17
9
158 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
Comment Utility
do you have a tadotable on each form?
0
 
LVL 1

Expert Comment

by:coondog091800
Comment Utility
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
Comment Utility
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
 
LVL 27

Expert Comment

by:kretzschmar
Comment Utility
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
Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

 

Author Comment

by:mem100
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
Thank you for returing and finalizing your open questions.
:) Moondancer - EE Moderator
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Creating an auto free TStringList The TStringList is a basic and frequently used object in Delphi. On many occasions, you may want to create a temporary list, process some items in the list and be done with the list. In such cases, you have to…
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…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
This video discusses moving either the default database or any database to a new volume.

772 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

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now