你可以写一个DLL,在Install Shield中调用他来完成工作。使用的是ODBC API SQLConfigDataSource,为Install Shield写扩展DLL可以在Install Shield中找到相关的帮助和例程。SQLConfigDataSource adds, modifies, or deletes data sources.SyntaxBOOL SQLConfigDataSource(
   HWND   hwndParent,
   WORD   fRequest,
   LPCSTR   lpszDriver,
   LPCSTR   lpszAttributes);ArgumentshwndParent[Input]
Parent window handle. The function will not display any dialog boxes if the handle is null.fRequest[Input]
Type of request. fRequest must contain one of the following values:ODBC_ADD_DSN: Add a new user data source.ODBC_CONFIG_DSN: Configure (modify) an existing user data source.ODBC_REMOVE_DSN: Remove an existing user data source.ODBC_ADD_SYS_DSN: Add a new system data source.ODBC_CONFIG_SYS_DSN: Modify an existing system data source.ODBC_REMOVE_SYS_DSN: Remove an existing system data source.ODBC_REMOVE_DEFAULT_DSN: Remove the default data source specification section from the system information. It also removes the default driver specification section from the ODBCINST.INI entry in the system information. (This fRequest performs the same function as the deprecated SQLRemoveDefaultDataSource function.) When this option is specified, all of the other parameters in the call to SQLConfigDataSource should be NULLs; if they are not NULL, they will be ignored.lpszDriver[Input]
Driver description (usually the name of the associated DBMS) presented to users instead of the physical driver name.lpszAttributes[Input]
List of attributes in the form of keyword-value pairs. For more information, see ConfigDSN in Chapter 22, “Setup DLL Function Reference.”

解决方案 »

  1.   

    最简单的办法是直接写注册表;
    HKEY_LOCAL_MACHINE\software\ODBC
    HKEY_LOCAL_MACHINE\software\ODBC.INI
      

  2.   

    就DSN而言,wingsun是对的,通过细查MSDN实现了。wjf的方法应该也可,不知兼容性如何。
    但安装驱动程序时遇到困难,QLConfigDriver 之类的API没用明白。后来发现installshield 带的一个template提供全部手段,完整、规范。最终采用这个办法。
    谢谢wingsun和wjf.