VB.NET和ADO.NET - 在运行时修改ConnectionString [英] VB.NET and ADO.NET - Modifying ConnectionString at run-time

查看:72
本文介绍了VB.NET和ADO.NET - 在运行时修改ConnectionString的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用oledb连接到数据库的小应用程序,

通过vis studio中的GUI向导设置。我希望将数据库位置与程序一起保存在.ini文件中,以便它可以更改以适应每个特定用户的设置。




问题是,如果我在运行时尝试修改

OleDBCOnnection.ConnectionString,那么我会收到错误

关于所说的连接字符串是un =初始化的。


任何人有任何想法吗?


Adam

I have a small application that uses oledb to connect to a database,
set up through the GUI wizards in vis studio. I am wanting to have
the database location kept in an .ini file along with the program so
that it can be changed to suit each particular user''s setup.

The problem is that if I try to modify
OleDBCOnnection.ConnectionString at run-time, then I get an error
about the said connectionstring being un=initialized.

Anyone got any ideas?

Adam

推荐答案

签出:如何:从应用程序存储和检索自定义信息

使用Visual Basic .NET配置文件: http://tinyurl.com/394qm

本文演示如何在配置中存储自定义信息

(.config)文件,您可以在运行时由其关联的

应用程序稍后检索。当您需要定义与应用程序关联的数据时,这非常有用。


-

Greetz,

Jan

__________________________________

阅读我的博客: http://weblogs.asp.net/jan

" Adam" < TR ****** @ picatnet.co.uk> schreef in bericht

新闻:97 ************************** @ posting.google.c om ...
Check out: HOW TO: Store and Retrieve Custom Information from an Application
Configuration File by Using Visual Basic .NET: http://tinyurl.com/394qm
This article demonstrates how to store custom information in a configuration
(.config) file that you can retrieve later during run time by its associated
application. This is a helpful when you need to define data that is
associated with an application.

--
Greetz,
Jan
__________________________________
Read my weblog: http://weblogs.asp.net/jan
"Adam" <tr******@picatnet.co.uk> schreef in bericht
news:97**************************@posting.google.c om...
我有一个小应用程序,它使用oledb连接数据库,通过vis studio中的GUI向导进行设置。我希望将数据库位置与程序一起保存在.ini文件中,以便可以根据每个特定用户的设置进行更改。

问题是,如果我尝试在运行时修改OleDBCOnnection.ConnectionString,那么我得到一个错误
关于所述连接字符串未被初始化。

任何人都有任何想法?

Adam
I have a small application that uses oledb to connect to a database,
set up through the GUI wizards in vis studio. I am wanting to have
the database location kept in an .ini file along with the program so
that it can be changed to suit each particular user''s setup.

The problem is that if I try to modify
OleDBCOnnection.ConnectionString at run-time, then I get an error
about the said connectionstring being un=initialized.

Anyone got any ideas?

Adam






引用:
Hi,

Quoting:
签出:如何:使用Visual Basic .NET从
ApplicationConfiguration文件存储和检索自定义信息:
http://tinyurl.com/394qm 本文演示了如何在
配置(.config)文件中存储自定义信息,以后可以在运行期间检索该文件时间由
相关应用程序完成。当您需要定义与应用程序相关的数据时,这非常有用。
Check out: HOW TO: Store and Retrieve Custom Information from an ApplicationConfiguration File by Using Visual Basic .NET: http://tinyurl.com/394qmThis article demonstrates how to store custom information in a configuration(.config) file that you can retrieve later during run time by its associatedapplication. This is a helpful when you need to define data that is
associated with an application.




我很难看到这对我有什么帮助。有人可以帮我吗

a有点长吗?


谢谢,


Adam



I''m having trouble seeing where this can help me. Can someone help me
a long a little bit please?

Thanks,

Adam


* tr******@picatnet.co.uk (Adam)scripsit:
* tr******@picatnet.co.uk (Adam) scripsit:
我有一个小应用程序,它使用oledb连接数据库,
通过vis studio中的GUI向导设置。我希望将数据库位置与程序一起保存在.ini文件中,以便可以根据每个特定用户的设置进行更改。

问题是,如果我尝试在运行时修改OleDBCOnnection.ConnectionString,那么我得到一个错误
关于所述连接字符串是un =初始化。
I have a small application that uses oledb to connect to a database,
set up through the GUI wizards in vis studio. I am wanting to have
the database location kept in an .ini file along with the program so
that it can be changed to suit each particular user''s setup.

The problem is that if I try to modify
OleDBCOnnection.ConnectionString at run-time, then I get an error
about the said connectionstring being un=initialized.



"邮政编码。"


-

Herfried K. Wagner [MVP]

< ; http://www.mvps.org/dotnet>



"Post code."

--
Herfried K. Wagner [MVP]
<http://www.mvps.org/dotnet>


这篇关于VB.NET和ADO.NET - 在运行时修改ConnectionString的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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