我想在数据库路径大于128时执行查询。这是一些客户的需要。
不起作用的例子。数据库路径大于128。我得到以下错误消息:
[FireDac][DatS]-32。列溢出[CATALOG_NAME]变量长度。值长度-[219],最大列长度-[128]。
try
Connection := TFDConnection.Create(Application);
Connection.Params.Add('DriverID=MSAcc');
Connection.Params.Add('Database=D:\donnees\TEST\GV\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\DC26.021248.PGOC.23.10.18_projCC45_dgn_topo.mdb');
Connection.Name := 'Test';
Connection.Connected := True;
FDQuery := TFDQuery.Create(Application);
FDQuery.Connection := Connection;
FDQuery.SQL.Text := 'SELECT * FROM PointTopo';
FDQuery.Active:= True;
finally
FDQuery.Active:= False;
Connection.Connected := False;
FreeAndNil(Connection);
FreeAndNil(FDQuery);
end;
这是一个有效的例子。数据库路径小于128
try
Connection := TFDConnection.Create(Application);
Connection.Params.Add('DriverID=MSAcc');
Connection.Params.Add('Database=D:\donnees\TEST\GV\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\FireDacCheminLong\DC26.021248.PGOC.23.10.18_projCC45_dgn_topo.mdb');
Connection.Name := 'Test';
Connection.Connected := True;
FDQuery := TFDQuery.Create(Application);
FDQuery.Connection := Connection;
FDQuery.SQL.Text := 'SELECT * FROM PointTopo';
FDQuery.Active:= True;
finally
FDQuery.Active:= False;
Connection.Connected := False;
FreeAndNil(Connection);
FreeAndNil(FDQuery);
end;
当数据库路径的长度大于128时,如何执行查询?
Cyril
- 操作系统:Windows 10 64 B
- R.A. D:Delphi 10.4
- 数据库:Access数据库(Office 365)
- Access数据库引擎:accessdatabaseengine_2016_X64
1条答案
按热度按时间lmyy7pcs1#
这不是一个直接的解决方案,而是一个变通方案。您可以将长路径上的文件夹Map到驱动器,因此very_long_path_name简单地变为G:\。