将XML文件中的值传递给VB.NET应用程序 [英] Passing values in XML file to VB.NET Application

查看:116
本文介绍了将XML文件中的值传递给VB.NET应用程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



在创建的应用程序中,我需要传递连接字符串值,以便可以连接到远程数据库服务器.

我不想对值进行硬编码,因为应用程序将永久绑定到特定服务器.

我想在XML文件中指定连接字符串值,但是如何从应用程序中检索它呢?

还可以将应用程序中的值写入XML文件吗?

请帮帮我!
谢谢.

Hi,

In the application that I have created, I need to pass the connection string value so that I can connect to a remote database server.

I don''t want to hard code the values because the application will be permanently bound to a particular server.

I want to specify the connection string values in the XML file, but how should I retrieve it from the application?

Also can I write values from the application into the XML file?

Please help me!
Thank You.

推荐答案

理想情况下,您应该将连接字符串存储在应用程序设置文件"中,并使用My.Application.Settings.strConnection 在您的应用程序中检索它们,并假设您将连接字符串另存为strConnection.要设置设置文件,请在解决方案资源管理器"中右键单击您的项目,然后选择属性".在出现的属性页面中,选择Settings选项卡,然后可以在其中保存连接字符串.在类型"下,您可以选择Connection String.
希望这会有所帮助
祝您编程愉快.
Ideally you should store your connection strings in the Application Settings File and retrieve them in your application by using My.Application.Settings.strConnection assuming your connection string is saved as strConnection. To set up your settings file, right click on your project in Solutions Explorer and select Properties. In the properties page that comes up select the Settings tab and you can save your connection string there. Under Type you can select Connection String.
Hope this helps
Happy Coding.


理想情况下,您应该将连接字符串存储在应用程序设置文件"中,并使用My.Application.Settings.strConnection在假定您的连接字符串另存为strConnection的情况下在应用程序中检索它们.要设置设置文件,请在解决方案资源管理器"中右键单击您的项目,然后选择属性".在出现的属性页面中,选择Settings选项卡,然后可以在其中保存连接字符串.在类型"下,您可以选择Connection String.
希望这会有所帮助
祝您编程愉快.
Ideally you should store your connection strings in the Application Settings File and retrieve them in your application by using My.Application.Settings.strConnection assuming your connection string is saved as strConnection. To set up your settings file, right click on your project in Solutions Explorer and select Properties. In the properties page that comes up select the Settings tab and you can save your connection string there. Under Type you can select Connection String.
Hope this helps
Happy Coding.


理想情况下,应该将连接字符串存储在应用程序设置文件"中,并使用My.Application.Settings.strConnection假定连接字符串另存为strConnection,从而在应用程序中检索它们.要设置设置文件,请在解决方案资源管理器"中右键单击您的项目,然后选择属性".在出现的属性页面中,选择Settings选项卡,然后可以在其中保存连接字符串.在类型"下,您可以选择Connection String.
希望这会有所帮助
祝您编码愉快.
Ideally you should store your connection strings in the Application Settings File and retrieve them in your application by using My.Application.Settings.strConnection assuming your connection string is saved as strConnection . To set up your settings file, right click on your project in Solutions Explorer and select Properties. In the properties page that comes up select the Settings tab and you can save your connection string there. Under Type you can select Connection String.
Hope this helps
Happy Coding.


这篇关于将XML文件中的值传递给VB.NET应用程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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