|
2#
楼主 |
发表于 2006-6-17 17:58:00
|
只看该作者
下面这个不知如何用到access里面
//uf_create_anywhere_odbc(as_conn_name,as_database_name,as_database_filename,as_app_path,as_window_path)
/*
as_conn_name //连接名
as_database_filename//数据据名
as_app_path//应用程序名
as_window_path//windows目录名
lzq2003年5月3日编写动态创建anywhere ODBC连接
*/
string ls_reg_key
environment lenv_env
if ( GetEnvironment(lenv_env) <> 1 ) then
lenv_env.ostype=windowsnt!
end if
choose case lenv_env.ostype
case windows!
ls_reg_key="HKEY_USERS\.DEFAULT\Software\ODBC\ODBC.INI\" +as_conn_name
RegistrySet("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources", as_conn_name, RegString!, "Sybase SQL Anywhere 5.0")
RegistrySet(ls_reg_key, "Driver", RegString!, as_app_path+"\wod50t.dll")
RegistrySet(ls_reg_key, "UID", RegString!, "")
RegistrySet(ls_reg_key, "WD", RegString!, "")
RegistrySet(ls_reg_key, "Start", RegString!, as_app_path+"\dbeng50.exe -d -Q -c512 ")
RegistrySet(ls_reg_key, "DatabaseFile", RegString!, as_app_path+"\" + as_database_filename)
RegistrySet(ls_reg_key, "DatabaseName", RegString!, as_database_name)
RegistrySet(ls_reg_key, "AutoStop", RegString!,"yes")
RegistrySet(ls_reg_key, "Description", RegString!,as_conn_name)
RegistrySet(ls_reg_key, "Agent", RegString!,"engine")
RegistrySet(ls_reg_key, "EngineName", RegString!,"dbeng50")
case windowsnt!
RegistryDelete("HKEY_USERS\.DEFAULT\Software\ODBC\ODBC.INI\" +as_conn_name, "")
case else
MessageBox( "提示信息", &
"应用程序只能运行在windows操作系统上!" )
RETURN
end choose
ls_reg_key="HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\" +as_conn_name
RegistrySet("HKEY_CURRENT_USER\Software\ODBC\ODBC.INI\ODBC Data Sources", as_conn_name, RegString!, "Sybase SQL Anywhere 5.0")
RegistrySet(ls_reg_key, "Driver", RegString!, as_app_path+"\wod50t.dll")
RegistrySet(ls_reg_key, "UID", RegString!, "")
RegistrySet(ls_reg_key, "WD", RegString!, "")
RegistrySet(ls_reg_key, "Start", RegString!, as_app_path+"\dbeng50.exe -d -Q -c512 ")
RegistrySet(ls_reg_key, "DatabaseFile", RegString!, as_app_path+"\" + as_database_filename)
RegistrySet(ls_reg_key, "DatabaseName", RegString!, as_database_name)
RegistrySet(ls_reg_key, "AutoStop", RegString!,"yes")
RegistrySet(ls_reg_key, "Description", RegString!,as_conn_name)
RegistrySet(ls_reg_key, "Agent", RegString!,"engine")
/egistrySet(ls_reg_key, "EngineName", RegString!,"dbeng50")
setProfileString (as_window_path+"\ODBC.INI", "ODBC 32 bit Data Sources", as_conn_name,"Sybase SQL Anywhere 5.0 (32 位)")
setProfileString (as_window_path+"\ODBC.INI",as_conn_name, "Driver32",as_app_path+"\wod50t.dll") |
|