How do I create an ODBC DSN entry using C#?

前端 未结 7 1242
旧巷少年郎
旧巷少年郎 2020-11-29 23:43

I\'m working on a legacy application that has a C++ extended stored procedure. This xsproc uses ODBC to connect to the database, which means it requires a DSN to be config

7条回答
  •  心在旅途
    2020-11-29 23:53

    There is a CodeProject page on reading ODBC information.

    Reading that should give you the information you need to reverse engineer writing the registry entries you need.

    From that code;

      private const string ODBC_LOC_IN_REGISTRY = "SOFTWARE\\ODBC\\";
      private const string ODBC_INI_LOC_IN_REGISTRY =
              ODBC_LOC_IN_REGISTRY + "ODBC.INI\\";
    
      private const string DSN_LOC_IN_REGISTRY =
              ODBC_INI_LOC_IN_REGISTRY + "ODBC Data Sources\\";
    
      private const string ODBCINST_INI_LOC_IN_REGISTRY =
              ODBC_LOC_IN_REGISTRY + "ODBCINST.INI\\";
    
      private const string ODBC_DRIVERS_LOC_IN_REGISTRY =
              ODBCINST_INI_LOC_IN_REGISTRY + "ODBC Drivers\\";
    

提交回复
热议问题