随着System.Data.SQLite如何使用相对路径指定在连接字符串中的数据库文件 [英] With System.Data.SQLite how do you specify a database file in the connect string using a relative path

查看:2265
本文介绍了随着System.Data.SQLite如何使用相对路径指定在连接字符串中的数据库文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

婉婷我的部署在不同服务器上我会preFER要能够指定使用相对路径连接字符串的项目。我似乎无法得到那个工作,想知道如果有一些窍门吧...?

Wanting to deploy my project on different servers I would prefer to be able to specify a connect string using a relative path. I can't seem to get that to work and want to know if there is some trick to it...?

推荐答案

这个怎么样?

"Data Source=|DataDirectory|mydb.db;..."

我相信 | DataDirectory目录| 点到您的应用程序所在的目录。我使用NHibernate和它具有以下工作:

I believe |DataDirectory| point to the directory where your app is located. I use NHibernate and it works with the following:

<add key="hibernate.connection.connection_string"
       value="Data Source=|DataDirectory|mydb.db;Version=3;Compress=False;synchronous=OFF;" >

这篇关于随着System.Data.SQLite如何使用相对路径指定在连接字符串中的数据库文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆