网站开发交什么税,做响应式网站需要学哪些知识,房地产设计师,wordpress 本地 域名绑定最近做一个小东西#xff0c;用到了subsonic#xff0c;因为用的是sqlite#xff0c;数据库的路径问题又被提了上来。在connectionStrings里面只能指定绝对路径。对于sqlite,access这样的数据库来说#xff0c;却需要使用到相对路径#xff0c;否则发布后就会出问题。自己…最近做一个小东西用到了subsonic因为用的是sqlite数据库的路径问题又被提了上来。在connectionStrings里面只能指定绝对路径。对于sqlite,access这样的数据库来说却需要使用到相对路径否则发布后就会出问题。自己了解的一些解决方案有 对asp.net数据库可以放在app_data里面在web.config里面使用|DataDirectory|来指定路径。 对winform可以制作安装程序在安装时生成connectionStrings。因为程序并不大所以不想制作安装程序。因为决定在程序启动时修改connectionStrings。 Configuration config ConfigurationManager.OpenExeConfiguration(ConfigurationUserLevel.None); #region Update //Update the connection config.ConnectionStrings.ConnectionStrings[Northwind].ConnectionString Data Source Application.StartupPath \Northwind.sl3; #endregion #region Add Create a connection string element and save it to the configuration file. Clear the connection //config.ConnectionStrings.ConnectionStrings.Clear(); //string csName Northwind; Create a connection string element. //ConnectionStringSettings csSettings // new ConnectionStringSettings(csName, // Data Source Application.StartupPath \Northwind.sl3); Get the connection strings section. //ConnectionStringsSection csSection // config.ConnectionStrings; Add the new element. //csSection.ConnectionStrings.Add(csSettings); #endregion #region Save // Save the configuration file. config.Save(ConfigurationSaveMode.Modified); //Refresh ,this is very important. ConfigurationManager.RefreshSection(connectionStrings); #endregion 转载于:https://www.cnblogs.com/icyflash/articles/1362229.html