Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
-
Tango
- Posts: 5
- Joined: Thu 02 Oct 2014 18:26
Post
by Tango » Thu 02 Oct 2014 18:37
Can I make relative path specified? If I make absolute path specified and later the database where otherwise move I get error message
Here a Screenshot
Thanks
-
AlexP
- Devart Team
- Posts: 5530
- Joined: Tue 10 Aug 2010 11:35
Post
by AlexP » Fri 03 Oct 2014 06:46
hello,
MS Access ODBC driver doesn't support relative paths, therefore you should generate a full path. For example, if the DB file is located in a ..\data\ folder relatively to your application, you can use the following code to generate the path:
UniConnection1.Database := ExtractFilePath(Application.ExeName) + 'data\MyDb.mdb';
-
Tango
- Posts: 5
- Joined: Thu 02 Oct 2014 18:26
Post
by Tango » Wed 15 Oct 2014 10:04
Thanks,
I've tried it. When I enter it in the source code I get
UniConection1 conected to false or UniQuery1 active to false
I give this one also in the source text, I get errors
UniConnection1.Database: = ExtractFilePath (Application.ExeName) + 'Abrechnung.accdb';
UniConnection1.Connected: = 'true'
UniQuery1.Active: = 'true'
I get error
-
AlexP
- Devart Team
- Posts: 5530
- Joined: Tue 10 Aug 2010 11:35
Post
by AlexP » Wed 15 Oct 2014 11:26
Please provide the text or a screenshot of the error message occurring on connection.
-
Tango
- Posts: 5
- Joined: Thu 02 Oct 2014 18:26
Post
by Tango » Thu 16 Oct 2014 05:59
here screenshot

-
AlexP
- Devart Team
- Posts: 5530
- Joined: Tue 10 Aug 2010 11:35
Post
by AlexP » Thu 16 Oct 2014 07:14
You are trying to assign a string value to a Boolean property. More details about this error are available in the
documentation
-
Tango
- Posts: 5
- Joined: Thu 02 Oct 2014 18:26
Post
by Tango » Thu 16 Oct 2014 13:08
how should it be the right?
If I example source would have at least as could have been combined with relative path, I could learn a lot
-
bork
- Devart Team
- Posts: 649
- Joined: Fri 12 Mar 2010 07:55
Post
by bork » Fri 17 Oct 2014 08:18
Code:
Code: Select all
UniConnection1.Connected := 'true';
it is the same as:
Code: Select all
var
b: boolean;
begin
b := 'true';
end;
This code can't be compiled, because a string constant can't be assigned to a boolean variable or property.
To get more information about data types compatibility and errors, please read the
documentation.
-
Tango
- Posts: 5
- Joined: Thu 02 Oct 2014 18:26
Post
by Tango » Sun 19 Oct 2014 16:41
I do not understand

have b defined as boolean
and UniConnection1.Connected: = b written does not work
ye have no Example where the database connection works with source code?
Code: Select all
procedure TForm1.FormCreate(Sender: TObject);
var
b: boolean;
begin
b:='true';
UniConnection1.Database:= ExtractFilePath (Application.ExeName) + 'Abrechnung.accdb';
UniConnection1.Connected:= b
UniQuery1.Active:= b
end;
-
bork
- Devart Team
- Posts: 649
- Joined: Fri 12 Mar 2010 07:55
Post
by bork » Mon 20 Oct 2014 11:05
The code:
can't be compiled, because b has the boolean data type, and the 'true' constant has the string data type. The string data type can't be assigned to a boolean variable or property.
You can assign only boolean constant to boolean variable or property :
or you should convert the string constant to boolean:
Please read the documentation for Delphi data types compatibility again:
here