使用setup factory 7.0打包PB程序中,当注册ODBC数据源时,我在操作-->进行安装时这一项上,增加了如下脚本:
Registry.CreateKey(HKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 8.0");
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 8.0", "Driver", "C:\\Program Files\\Sybase\\SQL Anywhere 8\\win32\\dbodbc8.dll", "REG_MULTI_SZ");
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\Adaptive Server Anywhere 8.0", "Setup", "C:\\Program Files\\Sybase\\SQL Anywhere 8\\win32\\dbodbc8.dll", "REG_MULTI_SZ");
Registry.SetValue(HKEY_LOCAL_MACHINE, "SOFTWARE\\ODBC\\ODBCINST.INI\\ODBC Drivers", "Adaptive Server Anywhere 8.0", "Installed", "REG_MULTI_SZ");
以上 "C:\\Program Files\\Sybase\\SQL Anywhere 8\\win32"部分,是本机dbodbc8.dll文件所在目录,如果发布后客户机可能会改变文件位置,那么应该怎样进行替换呢?以保证文件位置与客户安装目录一致。
------解决方案--------------------
Registry.SetValueHKEY_LOCAL_MACHINE, "Software\\ODBC\\ODBCINST.INI\\ASA8.0", "DRIVER",strInstallFolderPath .. "\\dbodbc8.dll", REG_MULTI_SZ);
strInstallFolderPath你可以看一下这个就是存放你选择的安装目录的变量