C#读取注册表项,将其与ini配置文件进行比较,如果与配置部分下的返回结果匹配,则执行其他操作
我遇到了以下问题,并且我的 C# 入门水平请帮助解决如何完成此任务?
设想: 1.我的注册表项:
__DatabaseConnection
|____config1
value: username1
value: password1
|____config2
value: username2
value:password2
我的ini文件:
[配置z]
数据库=MSSQL 数据库名称= ABC 主机=本地主机\项目
[配置1]
数据库=ORACLE 数据库名称= DEF 主机=服务器/数据
[配置N] 名称=xxxx Age=XXXX
问题:
我想读取这些注册表项,将它们与 ini 文件中的配置部分进行比较。
如果匹配,则返回数据库/名称/主机的值。 连接数据库服务器,删除数据库。 重复此过程,直到搜索到注册表中的所有项并删除所有数据库。
请帮忙! 此致, 杜伊。
I got below problem and with my entry level of C# please help on how to get this be done?
Scenario:
1. My registry keys:
__DatabaseConnection
|____config1
value: username1
value: password1
|____config2
value: username2
value:password2
My ini file:
[configz]
Database=MSSQL
DatabaseName= ABC
Host=localhost\projects[config1]
Database=ORACLE
DatabaseName= DEF
Host=server/data[configN]
Name=xxxx
Age=XXXX
Question:
I want to read those registry keys compare them to those configuration sections in ini file.
If match, return those value of database/ name/ host.
Connect to database server, delete the database.
Repeate the process until all keys in the registry is searched and all databases deleted.
Please help!
Best Regards,
Duy.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
有关 C# 中的注册表内容,请查看此处,特别是
GetValue()
方法。http://msdn.microsoft.com/en-us/ library/microsoft.win32.registry.aspx
要阅读 IniFiles,请参阅此帖子:读/写INI文件
For registry stuff in C# look here, particuarly the
GetValue()
method.http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx
For reading IniFiles see this SO post: Reading/writing an INI file