hur.cn - 华软网

 热门搜索

连接ACCESS数据库问题,本机上正常,换其它的电脑就不行了, 求求高高帮帮忙!

  作者:未知    来源:网络    更新时间:2018/1/1
我的ACCESS ODBC在本机上可以正常,但换台电脑就不行了,哪位帮忙指点一下?(有写动态注册ODBC的语句)
//连接语句
SQLCA.DBMS="ODBC"
SQLCA.AutoCommit = False
SQLCA.DBParm = "ConnectString='DSN=access'"
CONNECT;
if SQLCA.SQLCode = 0 THEN
//连接OK!
  open(main)
  return
end if

//注册ODBC EVENT

registryGet("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\MS Access Database","Driver",regstring!,db_driver)
//registryGet("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\MS Access Database","DriverId",regulong!,aa)
if isnull(db_driver) or db_driver='' then
messagebox('','请先安装ODBC驱动程序!(此程序OFFICE中已包含),或者手工配置ODBC!')
halt close
end if

//将数据源名称access注册到“HKEY_CURRENT_USER\software\odbc\odbc.ini\odbc data sources”下
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources","access",regstring!,"Microsoft Access Driver (*.mdb)")
//创建子键
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","",regstring!,"")
//创建连接到数据源所需要的参数
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","DBQ",regstring!,db_path)
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","Driver",regstring!,db_driver)
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","DriverId",ReguLong!,25)
//registryset
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","FIL",regstring!,"MS Access;")
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","PWD",regstring!,"admin")
//registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","ReadOnly",RegBinary!,0)//只读,二进制数
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","SafeTransactions",ReguLong!,0)
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access","UID",regstring!,"admin")
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access\Engines","",regstring!,"")
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access\Engines\Jet","",regstring!,"")
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access\Engines\Jet","ImplicitCommitSync",regstring!,"Yes")
registryset("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\access\Engines\Jet","UserCommitSync",regstring!,"Yes")

------华软网友回答------
错误提示: dbms odbc is not supported in your current installation. 

请问DBMS ODBC需要在什么样的环境下才支持?
------华软网友回复------
把pbodb90.dll 复制过去就可以了!(pb9.0)
------华软网友回复------
//==============================================================================
// Function: setodbc_pm()
//------------------------------------------------------------------------------
// Description: 
//------------------------------------------------------------------------------
// Arguments: 
// value string fs_dsn     
// value string fs_mdb_file
//------------------------------------------------------------------------------
// Returns:  (none)
//------------------------------------------------------------------------------
// Author: Kilojin Date: 2005.02.16
//------------------------------------------------------------------------------

string ls_sys[]
ls_sys[1]="HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC DRIVERS"
ls_sys[2]="HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI"
ls_sys[3]="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources"
ls_sys[4]="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI"

string ls_install
RegistryGet(ls_sys[1], "Microsoft Access Driver (*.mdb)", RegString!,ls_install)
if trim(ls_install)<> "Installed" then
messagebox("error","Microsoft Access Driver does not setup!")
halt
end if

RegistrySet(ls_sys[3], fs_dsn,RegString!,"Microsoft Access Driver (*.mdb)")
RegistrySet(ls_sys[4]+"\"+fs_dsn,"DBQ",RegString!,fs_mdb_file)
RegistrySet(ls_sys[4]+"\"+fs_dsn,"Driver",RegString!,"C:\WINDOWS\SYSTEM\odbcjt32.dll")
RegistrySet(ls_sys[4]+"\"+fs_dsn,"FIL",RegString!,"MS Access;")
RegistrySet(ls_sys[4]+"\"+fs_dsn,"PWD",RegString!,"sql")
RegistrySet(ls_sys[4]+"\"+fs_dsn,"UID",RegString!,"dba")

ulong lu_driverid,lu_SafeTransactions
lu_driverid=25
lu_SafeTransactions=0
RegistrySet(ls_sys[4]+"\"+fs_dsn,"DriverId",Regulong!,lu_driverid)
RegistrySet(ls_sys[4]+"\"+fs_dsn,"SafeTransactions",Regulong!,lu_SafeTransactions)
     
华软声明:本内容来自网络,如有侵犯您版权请来信指出,本站立即删除。