I am attempting to do direct access on a dBase file using UniDac components. In working through the UniDac example from the blog posting (https://blog.devart.com/delphi-component-for-dbf.html), I receive the "is not a valid path" error when I try to connect.
I am using UniDac trial version 8.4.4 with Delphi 10.4 on a 64-bit Windows 10 system.
I have followed the example in the blog as follows:
1. I drop TUniConnection, TUniQuery, TUniDataSource, TDBFUniProvider, TDBGrid and TButton components onto the form.
2. I set the UniConnection component provider to DBF provider, dBaseIII format, and set direct access to True.
3. I enter the database path d:\mytest.dbf, which is a known and tested dbf file. (The file is not open elsewhere.)
I then get the error "d:\mytest.dbf is not a valid path."
I have tried using other dBase formats, other dBase files, and other paths, but I always get the same error.
Can you tell me what might cause this error and how to fix it?
UniConnection error "not a valid path"
Re: UniConnection error "not a valid path"
Follow-up: It seems the problem was I expected the path to include the database filename, but it only expects a folder. When I changed it to just the folder the database is in, it works.
Re: UniConnection error "not a valid path"
Hi,
UniDAC recognizes Database option not as path to .dbf file but as catalogue which contains database files.
Here's an example of connecting and fetching all records of "Table_Name.DBF" located in "C:\Database\DBF\":
uses
Data.DB, MemDS, DBAccess, Uni, UniProvider, ODBCUniProvider, DBFUniProvider;
procedure TForm1.Button1Click(Sender: TObject);
begin
UniConnection1.Close;
UniConnection1.ProviderName := 'DBF';
UniConnection1.Database := 'C:\Database\DBF\';
UniConnection1.SpecificOptions.Values['DBFFormat'] := 'dfAuto';
UniConnection1.SpecificOptions.Values['Direct'] := 'True';
UniConnection1.LoginPrompt := False;
UniConnection1.Connected := True;
UniQuery1.SQL.Text := ' SELECT * FROM Table_Name';
UniQuery1.Open;
end;
Feel free to contact us anytime if you get any additional question or in case you would need any kind of assistance or instructions from our side.
Best regards,
Sergey
Devart Team
UniDAC recognizes Database option not as path to .dbf file but as catalogue which contains database files.
Here's an example of connecting and fetching all records of "Table_Name.DBF" located in "C:\Database\DBF\":
uses
Data.DB, MemDS, DBAccess, Uni, UniProvider, ODBCUniProvider, DBFUniProvider;
procedure TForm1.Button1Click(Sender: TObject);
begin
UniConnection1.Close;
UniConnection1.ProviderName := 'DBF';
UniConnection1.Database := 'C:\Database\DBF\';
UniConnection1.SpecificOptions.Values['DBFFormat'] := 'dfAuto';
UniConnection1.SpecificOptions.Values['Direct'] := 'True';
UniConnection1.LoginPrompt := False;
UniConnection1.Connected := True;
UniQuery1.SQL.Text := ' SELECT * FROM Table_Name';
UniQuery1.Open;
end;
Feel free to contact us anytime if you get any additional question or in case you would need any kind of assistance or instructions from our side.
Best regards,
Sergey
Devart Team