如何为App_Data中的Sql Compact添加连接?

时间:2016-11-29 08:40:38

标签: model-view-controller sql-server-ce

我已经在MVC中为我的项目创建了一个Sql Server Compact Database(名为testDb.sdf)。 我在App_Data文件夹中创建了文件,因此地址位置将独立于我的PC。 问题是从向导创建连接时。 我已经将此地址用于我的数据源:

|DataDirectory|\testDb.sdf

我按下测试连接后收到此错误:

  

找不到数据库文件,请检查数据库的路径。 [Data Scource = C:\ Program Files(x86)\ Microsoft Visual Studio 14.0 \ Common7 \ IDE \ testDb.sdf]

You can see the error in this picture better.

我应该在数据源地址栏中放置什么?

0 个答案:

没有答案
相关问题