0

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
  1. 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.

Daniel A. White
  • 187,200
  • 47
  • 362
  • 445
Duy
  • 1
  • 1
  • So what is the actual problem? What have you tried? Where are you stuck? – leppie Oct 15 '10 at 07:33
  • Why are you using the registry *and* an ini file? – Ed S. Oct 15 '10 at 07:43
  • @leppie: I stuck completely, i think of array types, but can not imaging how it work :( – Duy Oct 15 '10 at 07:46
  • @Ed: my tasks at work required, i am not familiar with C# – Duy Oct 15 '10 at 07:47
  • 1
    Have a stab at it yourself. You can easily find information on how to load and read text files and access the registry in C#. If you have specific problems then feel free to ask them — but this is not a free version of rentacoder. – Paul Ruane Oct 15 '10 at 08:07

1 Answers1

0

For registry stuff in C# look here, particuarly the GetValue() method.

http://msdn.microsoft.com/en-us/library/microsoft.win32.registry.aspx

public static Object GetValue(
    string keyName,
    string valueName,
    Object defaultValue
)

For reading IniFiles see this SO post: Reading/writing an INI file

Community
  • 1
  • 1
kyndigs
  • 3,074
  • 1
  • 18
  • 22