下面是调到COLLECT库的程序::
string dwh,bmh
blob lb_pic
if messagebox("提示","采集数据吗?",question!,yesno!)=2 then return
long erow,rrow,wrow,ret
cb_1.enabled=false
cb_2.enabled=false
transaction desql
desql=create transaction
desql.DBMS = "ODBC"
desql.AutoCommit = False
desql.DBParm = "ConnectString='DSN=collect;UID=dba;PWD=wangsw;'"
/////
if desql.DBMS='' or isnull(desql.DBMS) then
messagebox("系统文件错误","请检查程序运行路径或与系统管理员联系!")
halt
else
connect using desql ;
end if
if desql.sqlcode<>0 then
messagebox("数据库连接错误!","因为"+desql.sqlerrtext+"~n而无法连接数据库,请检查线路连接或通知系统管理员!")
return
end if
/////
declare uc_src cursor for select f_dwh,f_bmh from spbmdwry using desql ;
pipeline i_pipe
i_pipe=create u_pipeline
i_pipe.dataobject='p_src'
st_1.visible=true
ret=i_pipe.start(desql,sqlca,dw_1)
if ret=1 then
erow=i_pipe.RowsInError
rrow=i_pipe.RowsRead
wrow=i_pipe.RowsWritten
if erow>0 then dw_1.visible=true
sle_1.text=string(erow)
sle_2.text=string(rrow)
sle_3.text=string(wrow)
open uc_src ;
fetch uc_src into :dwh,:bmh ;
do while desql.sqlcode=0
selectblob f_zkp into :lb_pic from spbmdwry where f_dwh=:dwh and f_bmh=:bmh using desql;
if string(lb_pic)<>'' then
updateblob spbmdwry set f_zkp=:lb_pic where f_dwh=:dwh and f_bmh=:bmh using sqlca;
end if
fetch uc_src into :dwh,:bmh ;
loop
close uc_src ;
commit ;
messagebox("提示","数据采集完毕!")
else
messagebox("提示","数据采集错误,请与管理理员联系!")
end if
destroy i_pipe ;
disconnect using desql ;
st_1.visible=false
cb_1.enabled=true
IF Handle(GetApplication()) <> 0 THEN ////已编译
GetModuleFileNameA(Handle(GetApplication()),ls_Buffer,255)
END IF
ls_bz=profilestring('glwk.ini','other','安装标志','1')
if ls_bz='0' then
do while true
ll_pos=pos(ls_buffer,'\',ll_pos1+1)
if ll_pos=0 then exit
ll_pos1=ll_pos
loop
gs_path=left(ls_buffer,ll_pos1)
ls_buffer=left(gs_path,len(gs_path) -1)
ll_pos1=0
do while true
ll_pos=pos(ls_buffer,'\',ll_pos1+1)
if ll_pos=0 then exit
ll_pos1=ll_pos
loop
gs_path1=left(ls_buffer,ll_pos1)
SQLCA.DBMS = "ODBC"
SQLCA.DBParm = "ConnectString='DSN=rcgl;UID=dba;PWD=wangsw'"
if sqlca.DBMS='' or isnull(sqlca.DBMS) then
messagebox("系统文件错误","请检查程序运行路径或与系统管理员联系!")
halt
else
connect using sqlca ;
end if
if sqlca.sqlcode<>0 then
messagebox("数据库连接错误!","因为"+sqlca.sqlerrtext+"~n而无法连接数据库,请检查线路连接或通知系统管理员!")
halt
end if