第一个问题:
PB对数据库的编程,可以在外部建立ODBC,这是不是意味着 : 用PB开发的程序在移植到其他微机上时,还需要先建立好ODBC?
一般来说是这样的,也可以用代码建立.
关于动态注册ASA数据库ODBC数据源
//************************************************************//
// 函数名: //
// 功能: 主要是根据传入的库文件名,自动完成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_filename = as_filename + ".db"//获得数据库文件名字
ls_root = "HKEY_LOCAL_MACHINE\software\odbc\odbc.ini"
ls_root_table = ls_root + "\" + as_filename
li_return = 1
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
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!,"ndjwglxt")
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
li_rtn = registryset(ls_root_table,"PWD",regstring!,"jwglxt")
if li_rtn= - 1 then
li_return = 0
end if
li_rtn = registryset(ls_root_table,"UID",regstring!,"jwglxt")
if li_rtn= - 1 then
li_return = 0
end if
return li_return