本文介绍了如何创建动态连接字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



我收到错误,因为''无法为文件附加自动命名数据库:d:\ new folder \a.mdf''。

当我在其他PC上运行我的项目设置时会发生此错误。是否有任何解决方案来创建动态conectionString,以便当我将我的设置提供给任何人时它应该没有错误?

也我收到错误因为无法打开登录请求的数据库sample.mdf。登录失败。



请尽快帮助我..

Hi,
I am getting an error as ''unable to attach auto named database for file: " d:\new folder\a.mdf"''.
this error occurs when i run my project setup on other PC.Is there any solution to create a dynamic conectionString so that when i give my setup to anyone it should be error free?
also I am getting error as cannot open database "sample.mdf" requested by login.the login failed.

please help me as soon as possible..

推荐答案


string DPath=Application.StartupPath + "\\xyz.mdb"

string ConString = "Provider=Microsoft.Jet.Oledb.4.0;Data Source=" + DPath ;

OleDbConnection cnn = new OleDbConnection(ConString);





希望这会对你有所帮助.... :)



Hope this will help you.... :)


这篇关于如何创建动态连接字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-26 23:06
查看更多