最近编写一个应用,应用开始的时候,注册ODBC,然后连接,怪事发生了,表现在:
若新打开pb9开发环境就通过 DB profile 连接SQL数据库,则一切正常。若打开开发环境没有连接一下数据库,运行代码程序时,就显示数据库错误代码:DBMS ODBC is not supported in your current installation. 而这时再从开发环境的DB PROfile连接数据库也显示相同的错误了。
哪位高手碰到这种情况,请给出解决方法,谢谢了!急~~~~~
下面是应用里面关于注册ODBC的语句:
//ODBC\ODBCINST.INI\ODBC DRIVERS
RegistrySet('HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\ODBC DRIVERS','newaccount',RegString!,'newaccount')
RegistrySet('HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\newaccount','Driver',RegString!,"C:\WINDOWS\system32\sqlsrv32.dll")
RegistrySet('HKEY_LOCAL_MACHINE\Software\ODBC\ODBCINST.INI\newaccount','Setup',RegString!,"C:\WINDOWS\system32\sqlsrv32.dll")
//ODBC DATA SOURCE
registryset("HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\odbc data sources","newaccount",regstring!,"newaccount")
registryset("HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\newaccount","database",regstring!,"newaccount")
registryset("HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\newaccount","driver",regstring!,"C:\WINDOWS\system32\sqlsrv32.dll")
registryset("HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\newaccount","server",regstring!,"WEIKEYXP")
registryset("HKEY_LOCAL_MACHINE\software\odbc\odbc.ini\newaccount","lastuser",regstring!,"sa")
SetPointer(hourglass!)
SQLCA.DBMS =ProfileString("newaccount.ini","NEWACCOUNT","DBMS","ODBC")
SQLCA.AutoCommit = False
SQLCA.DBParm = "Connectstring='DSN=newaccount;UID=" + ProfileString("newaccount.ini","NEWACCOUNT","UID","") + ";PWD=" + ProfileString("newaccount.ini","NEWACCOUNT","PWD","") + "'"
CONNECT;