Administrator

Administrator

  • Tech Writer
  • 2.2k
  • 1.5m

Use COM Interop to Read and Write INI files in C#

Mar 5 2003 8:33 PM
Hello there, In the first place, thanx to federico and admin for helping me out with my previous problem on connection to SQL Server using Win authentication. But now i have another problem. I wanted to build a C# program that will have access to a SQL Server 2000 database. This sounds easy since you only need to build the connection string and the sql command and then hook it to the database. But what I want is a bit complicated as I wanted the values of the database connection string to be read from an INI file using Win32API. I found an article which is quite useful from the internet which teach us how to read from an INI file. The URL is : http://archive.devx.com/dotnet/discussions/040902/cominterop.asp But I wanted something more than what the web page can offer. I would like my program to be able to get some values from a key in a section and then process the values so that i can add it into a ComboBox. Example such as : [REPORT] REPORTNAMES=[productlocation],[inventory],[productmaster] In the above INI file, I wanted to separate the values within each of the [ ] i get from REPORTNAMES key in the REPORT section so that each one of them can be added to the ComboBox. Please help me out with this .... thanx =CmLaM=

Answers (1)