通过FireDac (Delphi)连接MS SQL LocalDB出错



连接参数:

Server=(LocalDb)MSSQLLocalDB
DriverID=MSSQL
ODBCAdvanced=AttachDbFileName=C:DirDirTestDB.mdf

connect is success .

请求,如FDConnection。ExecSQLScalar('SELECT ....') -工作良好通过TFDScript请求-工作良好

但是运行TFDQuery会产生以下错误:

[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][SQL Server]Could not find server 'C:DirDirTestDB' in sys.servers.
Verify that the correct server name was specified. 
If necessary, execute the stored procedure sp_addlinkedserver to add the server to sys.servers.

只需在连接字符串中添加Database=any_name。

Server=(LocalDb)MSSQLLocalDB
DriverID=MSSQL
ODBCAdvanced=AttachDbFileName=C:DirDirTestDB.mdf
Database=MyDatabase

最新更新