动态注册odbc之ASA篇

//************************************************************//
//  函数名:            // 
//      功能:  主要是根据传入的库文件名,自动完成ODBC的配置 //
//      一文件名在ODBC中注册数据源        //
//      输入:                  // 
//     ls_filename  文件名称(主要是库文件)      //
//     ls_dir   文件所在的目录        //
//  返回值:                  //
//     1  表示自动配置成功          //
//     0  表示自动配置失败          //
//  设计者: Adamswater               //
//  完成时间: 2003年10月              //
//                      //
//************************************************************//
integer li_return  //返回值
string ls_filename
integer li_rtn
string ls_root
string ls_root_table,ls_mm


ls_filename = as_filename + ".db"//获得数据库文件名字


ls_root = "HKEY_LOCAL_MACHINE/software/odbc/odbc.ini"
ls_root_table = ls_root + "/" + as_filename
//先判断是否已经注册过
//若还没注册过
li_rtn = registryset(ls_root,as_filename,regstring!,"")
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"AutoStop",regstring!,"Yes")
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"Compress",regstring!,"NO")
if li_rtn= - 1 then
 return 0
end if
li_rtn = registryset(ls_root_table,"DatabaseFile",regstring!,as_dir + "/"+ls_filename)
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"DatabaseName",regstring!,as_filename)
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"Debug",regstring!,"NO")
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"DisableMultiRowFetch",regstring!,"NO")
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"Driver",regstring!,as_dir + "/"+"dbodbc8.dll")
if li_rtn= - 1 then
 li_return = 0
end if
//'"C:/Program Files/Sybase/SQL Anywhere 8/win32/dbeng8.exe" -d -c8m'
li_rtn = registryset(ls_root_table,"Start",regstring!,as_dir + "/"+"dbeng8.exe -d -c8m")
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"EngineName",regstring!,"database")
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"Integrated",regstring!,"No")
if li_rtn= - 1 then
 li_return = 0
end if
ls_mm = left(MDString('ywdba',len('ywdba')),20)
li_rtn = registryset(ls_root_table,"PWD",regstring!,ls_mm)
if li_rtn= - 1 then
 li_return = 0
end if
li_rtn = registryset(ls_root_table,"UID",regstring!,"ywdba")
if li_rtn= - 1 then
 li_return = 0
end if
return li_return

 
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值