Solved

Delphi and ADO

Posted on 2002-04-17
9
159 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
loading dll from external path 1 212
Magic Software info 18 126
tidtcpserver connection lost handle 2 72
FMX and jaudiotracker playing memory stream 29 67
The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Have you ever had your Delphi form/application just hanging while waiting for data to load? This is the article to read if you want to learn some things about adding threads for data loading in the background. First, I'll setup a general applica…
This Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Windows 10 is mostly good. However the one thing that annoys me is how many clicks you have to do to dial a VPN connection. You have to go to settings from the start menu, (2 clicks), Network and Internet (1 click), Click VPN (another click) then fi…

863 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

27 Experts available now in Live!

Get 1:1 Help Now