用于MSDE分发的INSTALLSHIELD教本

    技术2022-05-11  62

    安装数据库: export prototype mydb_installed(); function mydb_installed()   string szcommand,szcmdline; begin      szcommand = supportdir^"sql2ksp4msde"^"setup.exe"; longpathtoshortpath(szcommand); szcmdline =" blanksapwd=1 sapwd=//""+svsapassword+"//" securitymode=sql  reboot=reallysuppress /qn";    longpathtoshortpath(szcmdline);      // 安装 mydb 数据库         sdshowmsg("正在安装 mydb 数据库...", true);     if (launchappandwait(szcommand, szcmdline, wait) < 0) then          messagebox ("mydb数据库安装失败!",severe);          sdshowmsg("正在安装 mydb 数据库...", false);          // 删除数据文件          deletedir(supportdir ^ "sql2ksp4", root);          abort;     endif;     deletedir(supportdir ^ "sql2ksp4", root);     sdshowmsg("正在安装 mydb 数据库...", false); end; 检测数据库是否存在 prototype checksql();  function checksql() bool bsuccess; number ntype, nvsize; string szver;  string szsetupver, szsetuppath,szsqlpath; begin   regdbsetdefaultroot ( hkey_local_machine );   szsetuppath = "softwaremicrosoftmssqlserversetup";    szsetupver = "softwaremicrosoftmssqlservermssqlservercurrentversion";   //获取sql server版本     ntype = regdb_string;   if (regdbgetkeyvalueex ( szsetupver, "currentversion" , ntype , szver , nvsize ) < 0) then      bsuccess = false;   else    //获取sql server安装路径    if (regdbgetkeyvalueex ( szsetuppath, "sqlpath" , ntype , szsqlpath , nvsize ) < 0) then     bsuccess = false;     else     bsuccess = true;    endif;   endif;   return bsuccess; end; 

    最新回复(0)