ODBC的配置问题,我用的是PB10,ASA 是9.0,我想用代码实现ODBC配置,然后让其脱离PB环境运行,可是总是出了错,能不能帮我看一下是什么错呀:<br /> 数据库名为:testdata.db<br /> 代码如下:<br /> integer li_return //返回值<br />string ls_filename<br />integer li_rtn<br />string ls_root<br />string ls_root_table<br />string as_filename,as_dir <br />as_filename = "testdata" <br />as_dir = GetCurrentDirectory() <br />ls_filename = as_filename + ".db"//获得数据库文件名字<br /><br />ls_root = "HKEY_LOCAL_MACHINE\software\odbc\odbc.ini"<br />ls_root_table = ls_root + "\" + as_filename<br />li_return = 1<br />li_rtn = registryset(ls_root,as_filename,regstring!,"")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"AutoStop",regstring!,"Yes")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"Compress",regstring!,"NO")<br />if li_rtn= - 1 then<br />return <br />end if<br />li_rtn = registryset(ls_root_table,"DatabaseFile",regstring!,as_dir + "\"+ls_filename)<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"DatabaseName",regstring!,as_filename)<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"Debug",regstring!,"NO")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"DisableMultiRowFetch",regstring!,"NO")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"Driver",regstring!,as_dir + "\"+"dbodbc9.dll")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"Start",regstring!,as_dir + "\"+"dbeng9.exe -d -c9m")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"EngineName",regstring!,"ndjwglxt")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"Integrated",regstring!,"No")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"PWD",regstring!,"sql")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br />li_rtn = registryset(ls_root_table,"UID",regstring!,"dba")<br />if li_rtn= - 1 then<br />li_return = 0<br />end if<br /><br />SQLCA.DBMS = "ODBC"<br />SQLCA.AutoCommit = False<br />SQLCA.DBParm = "ConnectString='DSN=anysql;databasename=testdata;UID=dba;PWD=sql'"<br />CONNECT USING SQLCA;<br />IF SQLCA.SQLCode = 0 THEN<br /> messagebox("提示","OK!")<br /> open(adminlogin)<br />ELSE<br /> messagebox("提示","ERROR")<br />END IF
-
编程的夜猫
回复于
2008-07-29
-
ODBC配置是很麻烦,我都是用ADO,关于ADO参考ASA帮助 有关设置