dcsimg


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: INI Files -- ODBC.ini

  1. #1
    Mister_Frosty Guest

    INI Files -- ODBC.ini


    Hello,

    [Background]
    I need my application's install to distribute a data source (.dsn) file.
    For the data source to work, I need to make entries into the ODBC.ini file
    and the registry.
    If there is an easy way to do this, please let me know.
    In the mean time, I am writing my own routines into VB's setup1.vbp code.

    [Immediate Problem]
    I need to make an entry into the [ODBC 32 bit Data Sources] section of the
    ODBC.ini file.
    The are more entries that follow this section, so I can't just append my
    entry to the file, as they will not be in the correct section.
    Is there a routine which will make entries into an ini file by specifying
    the file, section, and entry?
    The only way I see to do it, is to read each line of the file into a new
    temp file,
    until I get to the end of the section I want to make an entry into.
    I can then insert my entry, write the rest of the file into the temp file,

    and then delete the original file and rename my temp file.
    This seems like a lot of work for such a simple goal.
    If anyone knows of an alternative, I would greatly appreciate it.
    --Frost


  2. #2
    Phil Weber Guest

    Re: INI Files -- ODBC.ini

    > For the data source to work, I need to make entries into the
    > ODBC.ini file and the registry. If there is an easy way to do this,
    > please let me know.


    Frosty: See the following articles in the Microsoft Knowledge Base:

    HOWTO: Programmatically Create a DSN for SQL Server with VB
    ( http://support.microsoft.com/support.../q184/6/08.asp )

    HOWTO: Create and Remove a DSN in Visual Basic
    ( http://support.microsoft.com/support.../q171/1/46.asp )

    ---
    Phil Weber



  3. #3
    Colin McGuigan Guest

    Re: INI Files -- ODBC.ini

    Phil Weber wrote in message <38d8ee3d@news.devx.com>...
    > > For the data source to work, I need to make entries into the
    > > ODBC.ini file and the registry. If there is an easy way to do this,
    > > please let me know.

    >
    >Frosty: See the following articles in the Microsoft Knowledge Base:
    >
    > HOWTO: Programmatically Create a DSN for SQL Server with VB
    > ( http://support.microsoft.com/support.../q184/6/08.asp )
    >
    > HOWTO: Create and Remove a DSN in Visual Basic
    > ( http://support.microsoft.com/support.../q171/1/46.asp )
    >
    >---
    >Phil Weber



    To add on, yes, there are API calls that manage INI files (including the
    reading and writing of entries); Karl has a good INI example on his web
    site: http://www.mvps.org/vb/index2.html?samples.htm

    However, for the reason _why_ you asked, I'd go with the KB articles that
    Phil pointed out. =)


    --
    Colin McGuigan




Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center