Solved

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

Posted on 2011-03-22
2
935 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:
Ephraim Wangoya 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

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…
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…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

733 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