pb 自动配置ODBC连接sql Anywhere

PB11专栏   2009-06-29 00:10   阅读139   评论1  
字号:    
anywhere 5:
String ls_dbFile, ls_OrgID, ls_AppPath

ls_AppPath = Space(144)
if GetCurrentDirectoryA(144, ls_apppath)>0 then ls_apppath=trim(ls_apppath)
gs_apppath=ls_apppath

ls_dbfile=".\db\*.db"
If Lower(ls_dbFile) = Lower(ls_AppPath + '\DB\*.db') Then Return

RegistrySet(gs_KeyODBC, 'Autostop', 'Yes')
RegistrySet(gs_KeyODBC, 'DatabaseName', '*')
RegistrySet(gs_KeyODBC, 'DatabaseFile', ls_AppPath + '\DB\*.db')
RegistrySet(gs_KeyODBC, 'UID', 'DBA')
RegistrySet(gs_KeyODBC, 'PWD', 'SQL')
RegistrySet(gs_KeyODBC, 'Driver', ls_AppPath + '\DB\wod50t.dll')
RegistrySet(gs_KeyODBC, 'Start', ls_AppPath + '\DB\dbeng50.exe -Q')

anywhere 11:
String ls_dbFile, ls_OrgID, ls_AppPath

ls_AppPath = Space(144)
if GetCurrentDirectoryA(144, ls_apppath)>0 then ls_apppath=trim(ls_apppath)

gs_apppath = ls_apppath
ls_dbfile=".\DB\*.db"
If Lower(ls_dbFile) = Lower(ls_AppPath + '\DB\*.db') Then Return

RegistrySet(gs_KeyODBC, 'Autostop', 'Yes')
RegistrySet(gs_KeyODBC, 'DatabaseName', '*')
RegistrySet(gs_KeyODBC, 'DatabaseFile', ls_AppPath + '\DB\*.db')
RegistrySet(gs_KeyODBC, 'UID', 'dba')
RegistrySet(gs_KeyODBC, 'PWD', 'sql')
RegistrySet(gs_KeyODBC, 'Driver', ls_AppPath + '\DB\dbodbc11.dll')
RegistrySet(gs_KeyODBC, 'Start', ls_AppPath + '\DB\dbeng11.exe -Q')


其中:
global variables:
Constant String gs_KeyODBC = 'HKEY_CURRENT_USER\SOFTWARE\ODBC\ODBC.IN\*'
global external functions:
Function ulong GetCurrentDirectoryA (ulong textlen, ref string dirtext) library "KERNEL32.DLL" alias for "GetCurrentDirectoryA;Ansi"
*代表数据源名称,#代表odbc名称.
当然,还必不可少相关动态库.
有关动态库的文章请看:
pb11之前版本的请看:
http://oscarhd2121.blogspot.com/2009/03/pb.html
pb 11版本的请看:
http://oscarhd2121.blogspot.com/2009/03/pb-11sql-anywhere-11.html

评论(?)
阅读(?)
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
网易公司版权所有 ©1997-2009