马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有账号?站点注册
×
1.关于动态注册Access数据源
//*********************************************** // 函数名: gf_setodbc_access // 功能: 完成access数据源的注册功能 // 输入参数: // as_database 数据库名 // (即Access数据库文件名字,不含扩展名) // as_path 数据库文件所在的目录 // 返回值: // true 表示自动配置成功 // false 表示自动配置失败 // 设计者: Adamswater // 完成时间: 2005年6月 //*************************************************** boolean lb_rtn string ls_root,ls_root_dsn,ls_root_Jet,ls_root_Engines integer li_rtn string ls_dsnname,ls_dbfullname,ls_driver,temp,ls_version string ls_syspath environment env
integer rtn
ls_syspath = Space( 40 ) //获得操作系统的目录 GetSystemDirectoryA(ls_syspath,60) ls_driver = ls_syspath + "\odbcjt32.dll" lb_rtn = true ls_root = "HKEY_LOCAL_MACHINE\software\odbc\odbc.ini" //数据源名字为:文件名字+“_DT” ls_dsnname = as_database + "_DT" ls_root_dsn = ls_root + "\" + ls_dsnname ls_root_Engines = ls_root_dsn + "\" + "Engines" ls_root_Jet = ls_root_Engines + "\" + "Jet" ls_dbfullname = as_path + "\" + as_database + ".mdb" //注册数据源的名字 li_rtn = registryset(ls_root,ls_dsnname,regstring!,"") if li_rtn= - 1 then return false end if //注册数据库名字 li_rtn = registryset(ls_root_dsn,"DBQ",regstring!,ls_dbfullname) if li_rtn= - 1 then return false end if //注册数据库驱动程序 li_rtn = registryset(ls_root_dsn,"Driver",regstring!,ls_driver) if li_rtn= - 1 then return false end if
//注册其它项 li_rtn = registryset(ls_root_dsn,"FIL",regstring!,"MS Access;") if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"Description",regstring!,"条形码打印程序") if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"UID",regstring!,"") if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"DriverId", RegULong!,25) if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"SafeTransactions", RegULong!,0) if li_rtn= - 1 then return false end if //注册"Engines"项 li_rtn = registryset(ls_root_dsn,"Engines",regstring!,"") if li_rtn= - 1 then return false end if //注册"Jet"项 li_rtn = registryset(ls_root_Engines,"Jet",regstring!,"") if li_rtn= - 1 then return false end if //注册"Jet"项的各个子项 li_rtn = registryset(ls_root_Jet,"ImplicitCommitSync",regstring!,"") if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_Jet,"UserCommitSync",regstring!,"Yes") if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_Jet,"MaxBufferSize", RegULong!,2048) if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_Jet,"PageTimeout", RegULong!,5) if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_Jet,"Threads", RegULong!,3) if li_rtn= - 1 then return false end if return lb_rtn
2.关于动态注册DBF数据源
//************************************************************// // 函数名: autosetodbc // // 功能: 主要是根据传入的库文件名,自动完成ODBC的配置 // // 一文件名在ODBC中注册数据源 // // 输入: // // ls_file 文件名称(主要是库文件) // // ls_path 文件所在的目录 // // as_drivedir 驱动程序路径 // // 返回值: // // 1 表示自动配置成功 // // 0 表示自动配置失败 // // 设计者: Adamswater // // 完成时间: 2003年10月 // // // //************************************************************// integer li_return //返回值 string ls_filename //库文件名 string ls_fileend //文件的扩展名 string ls_filedir //文件所在的目录 string ls_driver //驱动程序 integer li_rtn blob lb_value string ls_root string ls_root_table
li_return = 1 ls_driver = as_drivedir + +"\vfpodbc.dll" ls_fileend = right(ls_file,3) //获得文件的扩展名 ls_filename = left(ls_file,pos(ls_file,'.',1) - 1) //获得文件名 ls_filedir = ls_path//left(ls_path,lastpos(ls_path,'\') - 1) ls_root = "HKEY_LOCAL_MACHINE\software\odbc\odbc.ini" ls_root_table = ls_root + "\" + ls_filename if ls_fileend="dbf" then //先判断是否已经注册过 //当选择的是DBF文件时 li_rtn = registryset(ls_root,ls_filename,regstring!,"") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"BackgroundFetch",regstring!,"Yes") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Collate",regstring!,"Machine") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Deleted",regstring!,"Yes") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Collate",regstring!,"Machine") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Description",regstring!,"") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Driver",regstring!,ls_driver) if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Exclusive",regstring!,"No") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"Null",regstring!,"Yes") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"SetNoCountOn",regstring!,"No") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"SourceDB",regstring!,ls_filedir) if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"SourceType",regstring!,"DBF") if li_rtn= - 1 then return 0 end if else end if return li_return
3.关于动态注册SQL Server数据源
//*********************************************** // 函数名: gf_setodbc_sqlserver // 功能: 完成sqlserver数据源的注册功能 // 输入参数: // as_database 数据库名 // as_server 服务器名
// 返回值: // true 表示自动配置成功 // false 表示自动配置失败 // 设计者: Adamswater // 完成时间: 2005年6月 // //*************************************************** boolean lb_rtn string ls_root,ls_root_dsn integer li_rtn string ls_dsnname
lb_rtn = true ls_root = "HKEY_LOCAL_MACHINE\software\odbc\odbc.ini" ls_dsnname = as_database + "_DT"//数据源的名字:数据库名字_DT,当然可以修改 ls_root_dsn = ls_root + "\" + ls_dsnname
li_rtn = registryset(ls_root,ls_dsnname,regstring!,"") if li_rtn= - 1 then return false end if
//指定数据库名字 li_rtn = registryset(ls_root_dsn,"Database",regstring!,as_database) if li_rtn= - 1 then return false end if
//指定驱动程序 li_rtn = registryset(ls_root_dsn,"Driver",regstring!,'C:\WINNT\System32\SQLSRV32.dll') if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"LastUser",regstring!,'sa') if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"Server",regstring!,upper(as_server)) if li_rtn= - 1 then return false end if li_rtn = registryset(ls_root_dsn,"Trusted_Connection",regstring!,'Yes') if li_rtn= - 1 then return false end if return lb_rtn
4.关于动态注册ASA数据库ODBC数据源
//************************************************************// // 函数名: // // 功能: 主要是根据传入的库文件名,自动完成ODBC的配置 // // 一文件名在ODBC中注册数据源 // // 输入: // // ls_filename 文件名称(主要是库文件) // // ls_dir 文件所在的目录 // // 返回值: // // 1 表示自动配置成功 // // 0 表示自动配置失败 // // 设计者: Adamswater // // 完成时间: 2003年10月 // //************************************************************// integer li_return //返回值 string ls_filename integer li_rtn string ls_root string ls_root_table
ls_filename = as_filename + ".db"//获得数据库文件名字
ls_root = "HKEY_LOCAL_MACHINE\software\odbc\odbc.ini" ls_root_table = ls_root + "\" + as_filename li_return = 1 li_rtn = registryset(ls_root,as_filename,regstring!,"") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"AutoStop",regstring!,"Yes") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"Compress",regstring!,"NO") if li_rtn= - 1 then return 0 end if li_rtn = registryset(ls_root_table,"DatabaseFile",regstring!,as_dir + "\"+ls_filename) if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"DatabaseName",regstring!,as_filename) if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"Debug",regstring!,"NO") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"DisableMultiRowFetch",regstring!,"NO") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"Driver",regstring!,as_dir + "\"+"dbodbc8.dll") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"Start",regstring!,as_dir + "\"+"dbeng8.exe -d -c8m") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"EngineName",regstring!,"ndjwglxt") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"Integrated",regstring!,"No") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"PWD",regstring!,"jwglxt") if li_rtn= - 1 then li_return = 0 end if li_rtn = registryset(ls_root_table,"UID",regstring!,"jwglxt") if li_rtn= - 1 then li_return = 0 end if return li_return
IsUninst "/UNINST=D:\111\UnInst.log" "/APPNAME=学生管理系统"
C:\WINNT\GPInstall.exe "/UNINST=D:\111\UnInst.log" "/APPNAME=学生管理系统" |