Solved

Can't get TAdsConnection to accept run-time data location assignment

Posted on 2011-03-22
2
920 Views
Last Modified: 2012-06-27
I am using Delphi XE with Advantage local server (9.1) on Windows 7.  I do not know the data table location until run-time and so have code that assigns the ConnectPath and IsConnected properties during the creation of the data module.  However, I keep getting the following error message:

Exception EADSDatabaseError in module DD3CRMOut.exe at 0048AAB4.  acctTbl: One of the DatabaseName property or the AdsConnection property must have a value.

acctTbl is the first table in the data module.  The table has a value in the AdsConnection property (Which is the name of the AdsConnection) and the Active property is set to false.

The AdsConnection ConnectPath property is null and the IsConnected property is set to false.

If I enter a location that has a table in the ConnectPath property of AdsConnection, the error messages go away (even though the IsConnected property is still false).

I need to be able to provide the data location only at run-time.  How do I do this?
0
Comment
Question by:sysjames
2 Comments
 
LVL 32

Accepted Solution

by:
ewangoya earned 500 total points
ID: 35195266

There could be somewhere else in your code that is trying to make a connection when the form or datamodule is being created.
Check your FormCreate/DataModuleCreate methods or any other form that uses this connection if they are trying to set the Connected property to true.
Or possibly one of the tables has its active property set to true before the AdsConnection's path has been set to a valid path at runtime

Now if you are going to get the correct path at runtime, there is no harm in leaving  a dummy ConnectPath on the connection since you will ovewrite it at runtime but its better to find out what is calling the connection and causing the error
0
 

Author Comment

by:sysjames
ID: 35202747
All of your advice is good amd I've checked all those things.  I am now going to create a known data area on the disk and use it (hard coded) because I'm running out of time for this release).

Example.  I made a routine for the BeforeOpen event of the table in question.  I set a breakpoint there and the error occured before the breakpoint was encountered.  Which I don't understand how that could be.

Thanks again.
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

Introduction I have seen many questions in this Delphi topic area where queries in threads are needed or suggested. I know bumped into a similar need. This article will address some of the concepts when dealing with a multithreaded delphi database…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
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…
Illustrator's Shape Builder tool will let you combine shapes visually and interactively. This video shows the Mac version, but the tool works the same way in Windows. To follow along with this video, you can draw your own shapes or download the file…

744 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