int answer,answer1,answer2,answer3,answer4,answer5,answer6
string ls_driver,ls_trans,app_path,db_path
app_path=sle_1.text //应用程序安装路径
ls_driver=app_path+'\dbodbc7.dll'
ls_trans=app_path+'dbodtr7.dll'
if not fileexists(ls_driver) then
messagebox("错误","没有ASA7.0驱动程序,系统将终止运行!",stopsign!)
return
end if
answer=registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INT\ODBC Drivers','Adaptive Server Anywhere7.0',RegString!,'Installed')
if answer=-1 then
messagebox("错误","应用程序无法配置ODBC DRIVERS,系统将终止运行!",stopsign!)
return
end if
answer1=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0','Driver',RegString!,ls_driver)
answer2=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0','CPTimeout',RegString!,'not pooled')
answer3=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0','Setup',RegString!,ls_driver)
if answer1=-1 or answer2=-1 or answer3=-1 then
messagebox("错误","应用程序无法配置ODBCINST.INI,程序将终止执行!",stopsign!)
return
end if
answer1=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 Translator','Driver',RegString!,ls_trans)
answer2=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 Translator','Setup',RegString!,ls_trans)
answer3=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 Translator','Driver',RegString!,ls_trans)
if answer1=-1 or answer2=-1 or answer3=-1 then
messagebox("错误","应用程序无法配置ODBCINST.INI,程序将终止执行!",stopsign!)
return
end if
answer=Registryset('HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.INI\ODBC Data Sources','tv_net',RegString!,'Adaptive Server Anywhere7.0')
if answer=-1 then
messagebox("错误","应用程序无法配置ODBC DATA SOURCES 名称,程序将终止执行!",stopsign!)
return
end if
db_path=app_path+'\tv_net.db'
answer1=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 ','Driver',RegString!,ls_driver)
answer2=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 ','Autostop',RegString!,'yes')
answer3=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 ','Integrated',RegString!,'no')
answer4=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 ','UID',RegString!,'dba')
answer5=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 ','PWD',RegString!,'sql')
answer6=Registryset('HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Adaptive Server Anywhere7.0 ','Databasefile',RegString!,db_path)
close(parent)
if answer1=-1 or answer2=-1 or answer3=-1 or answer4=-1 or answer5=-1 or answer6=-1 then
messagebox("错误","应用程序无法自动配置ODBC.INT细节,应用程序将结束!",stopsign!)
else
messagebox("成功","ODBC已成功注册!",exclamation!)
end if