2016-09-30 97 views
2

連接參數:錯誤通過FireDac(DELPHI)連接到MS SQL的LocalDB

Server=(LocalDb)\MSSQLLocalDB 
DriverID=MSSQL 
ODBCAdvanced=AttachDbFileName=C:\Dir\Dir\TestDB.mdf 

連接是成功的。

要求像FDConnection.ExecSQLScalar( 'SELECT ...') - 通過TFDScript做工精良 Requets - 做工精良

但運行TFDQuery生成以下錯誤:

[FireDAC][Phys][ODBC][Microsoft][SQL Server Native Client 11.0][SQL Server]Could not find server 'C:\Dir\Dir\TestDB' 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. 

回答

2

只需添加數據庫= any_name連接字符串。

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