At design time I gave to the property ConnectionString some information and
the full path for the Access file.....
But, at desgin time, I gave for example C:\MyDatabase\MyDatabase.mdb. It's
possible than the database is not is this directory on the others computers.
How can I do for give the right path ? I'l like give tha path and after
that activate the ADOConnection in the Main form OnActivate event ...
Bye
--
------------
French Mailing List Visual C++ and Borland C++ Builder
French Mailing List Flash on my web site
----- Christian Ista's Softs http://www.IstaSofts.com
----- Christian Ista (Liege-Belgium) on IRC Boubou, ^Boubou^,...
----- Christi...@bigfoot.com ou Ista...@bigfoot.Com
--
Bill
Bill Todd (TeamB)
(TeamB cannot respond to questions received via email)
Yes at desgin time. But If I want to install my software on an another PC,
the database is may be at the same place...
> Another approach is
> to use a UDL file and create the file with the correct path as part of
your
> installation process. UDL's are just text files.
How to put the content of this text file in the ConnectionString Property ?
> To create one as a sample
> right click in explorer, choose new, then choose Microsoft Data Link
I tried wih windows 95 (DCOM + MDAC 2.1), I can see this option in the
popmenu (right click) but not wiht windwos NT + SP 6 + MDAC 2.5
Bye
FILE NAME=C:\Program Files\Common Files\System\ole db\Data Links\DBDEMOS.udl
If I want to change the string in code I could do something like
ADOConnection1.ConnectionString := 'FILE NAME=' +
ChangeFileExt(Application.ExeName, '.udl');
to set the connection string to a UDL file that has the same name as my EXE
and is in the same directory as my EXE. If you do not want to use a UDL file
create a connection string at design time using the property editor then
copy the connection string to Notepad or the code editor so it is easy to
see the whole string. Somewhere in the string you will find the path to the
database. All you have to do is write code to change that part of the string
at runtime.
If this does not answer your questions please explain what it is that you do
not understand and I will try to help.
Hello Bill and the other,
I did, in OnActivate (MainForm) ....
1. Close all the tables
2. Disconnect the ADOConnection
3. ADOConnection1.ConnectionString := 'FILE NAME=' +
ChangeFileExt(Application.ExeName, '.udl');
4. Connect ADOConnection
and at this moment, I receive this message .... "The file %1 is not a valid
compound file" ....
If I do only the point 3 I receive this message "Operation is not allowed
when the object is open", it's normal I think...
Bye
try
3. ADOConnection1.ConnectionString := 'FILE NAME=' + ExtractFilePath
(Apllication.ExeName) + '\MyConn.udl';
Works for me.
--
cmpe...@hotmail.com
Home Of ReefCon 2K - Aquarium Maintainence,
Reference, Logging, and Control software
http://www.cmpenney.com
Sent via Deja.com http://www.deja.com/
Before you buy.