NSIS ODBC Driver 安装及新建(例MySQL ODBC Driver 3.5.1)

Section -RegODBC SEC02
  ReadRegStr $0 HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" "MySQL ODBC 3.51 Driver"
  StrCmp $0 "Installed" OK    #判断MySQL ODBC 3.51 Driver是否安装
  SetOutPath "$SYSDIR"
  SetOverwrite ifnewer
  File  "F:\setup\myodbc3.dll"
  File  "F:\setup\myodbc3S.dll"
  File  "F:\setup\msvcr71.dll"
  
  WriteRegStr HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" Driver "$SYSDIR\myodbc3.dll"
  WriteRegStr HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" Setup "$SYSDIR\myodbc3S.dll"
  WriteRegDWORD HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver" UsageCount "00000001"
  WriteRegStr HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" "MySQL ODBC 3.51 Driver" "Installed"
OK:
nsODBC::AddSysDSN "MySQL ODBC 3.51 Driver" "DSN=testdb" "Description=testdb" "Server=localhost" "User=root" "Password=root" "Database=testdb"
SectionEnd


Section Uninstall
nsODBC::RemoveSysDSN "MySQL ODBC 3.51 Driver" "DSN=testdb" "Description=testdb" "Server=localhost" "User=root" "Password=root" "Database=testdb"
  Delete "$SYSDIR\myodbc3.dll"
  Delete "$SYSDIR\myodbc3S.dll"
  Delete "$SYSDIR\msvcr71.dll"
  DeleteRegKey HKLM "SOFTWARE\ODBC\ODBCINST.INI\MySQL ODBC 3.51 Driver"
  DeleteRegValue HKLM "SOFTWARE\ODBC\ODBCINST.INI\ODBC Drivers" "MySQL ODBC 3.51 Driver"
  SetAutoClose true
SectionEnd

使用nsis插件 NsODBC    地址 http://nsis.sourceforge.net/NsODBC_plug-in

你可能感兴趣的:(mysql,server,File,user,database,delete)