oledbconnection [英] oledbconnection
本文介绍了oledbconnection的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
当我在客户端计算机上加载应用程序时,
我收到以下错误:
When I load my application on client machine,
I get the following error:
g:\database\hello.mdb is not valid path.
客户端计算机上没有g:驱动器,因此我对此并不了解.
like ::
something \ hello.mdb
There is no g: drive on the client computer, so I dont have a easy idea for it.
like::
something\hello.mdb
推荐答案
从您的问题来看,您似乎已经对数据库进行了硬编码.总是一个坏主意.
解决此问题的一种方法是对数据库访问进行错误检查,如果找不到,请放置FolderBrowser
以便用户导航到正确的位置.然后将该位置存储在配置文件/注册表/下次可以使用的任何位置.
From your question it looks like you have the path to the DB hard coded. Always a bad idea.
One way to resolve this is to error check on the DB access and if not found put up aFolderBrowser
for the user to navigate to the proper location. Then store that location in the config file/registry/wherever ready for next time.
最简单的方法是使用设置文件,然后在其中配置相关路径.
然后,在代码中,您将引用settings参数,因此它永远不需要更改代码.
http://www.devsource.com/c/a/Languages /VBNET-Using-MySettings-for-Application-Settings/ [
The easiest thing to to would be to use a settings file, and then configure the relevant path in there.
Then in the code you would reference the settings parameter, so it would never need the code changing.
http://www.devsource.com/c/a/Languages/VBNET-Using-MySettings-for-Application-Settings/[^]
您将必须使用应用程序设置来执行此操作.
或通过其他方式存储数据库路径.
或者,您可以选择在安装时将数据库放在一个公用文件夹中并使用该文件夹. (但不建议将其用于数据库)
看看这些链接:
http://articles.techrepublic.com.com/5100-10878_11-5779516.htm [ ^ ]
http://msdn.microsoft.com/en-us/library/a65txexh (v = vs.80).aspx [ http://www.ezzylearning.com/tutorial.aspx?tid=806732 [ ^ ]
You''ll have to use a application setting to do this.
Or some other way to store the path to your database.
Or you can opt to put the database in a common folder at installation and use that one. (but this is not recommended for a database)
Take a look at these links:
http://articles.techrepublic.com.com/5100-10878_11-5779516.htm[^]
http://msdn.microsoft.com/en-us/library/a65txexh(v=vs.80).aspx[^]
http://www.ezzylearning.com/tutorial.aspx?tid=806732[^]
这篇关于oledbconnection的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文