|
2#
楼主 |
发表于 2009-1-7 17:39:44
|
只看该作者
用ADO搞定
Set Res = CreateObject("ADODB.Recordset")
Set Cmd = CreateObject("ADODB.Command") 'Oracle
StrCon ="DRIVER={Oracle in OraHome92};SERVER=localhost;UID=XXXWD=XXX;DBQ=XXX;DBA=W;APA=T;EXC=F;XSM=Default;FEN=T;QTO=T;FRC=10;FDL=10;LOB=T;RST=T;GDE=F;FRL=Lo;BAM=IfAllSuccessful;MTS=F;MDI=Me;CSR=F;FWC=FFC=6000;TLO=O;"
Cmd.activeconnection=StrCon
Cmd.CommandType =1
SQL = " select rp_id,rp_data,rp_name,RP_PARENT_PATH from REPOSITORY where "
SQL = SQL & " rp_name='Results.xml' and RP_PARENT_PATH like (select RP_PARENT_PATH||'%' from REPOSITORY where RP_NAME="
SQL = SQL & " (select rn_path from run where rn_cycle_id='" & cycleid & "' and rn_test_id='" & testid & "' and rn_run_id=(select max(rn_run_id) from run where rn_cycle_id='" & cycleid & "' and rn_test_id='" & testid & "')))"
SQL = SQL & " and rp_id=(select max(rp_id) from REPOSITORY "
SQL = SQL & " where rp_name='Results.xml' and RP_PARENT_PATH like (select RP_PARENT_PATH||'%' from REPOSITORY where RP_NAME="
SQL = SQL & " (select rn_path from run where rn_cycle_id='" & cycleid & "' and rn_test_id='" & testid & "' and rn_run_id=(select max(rn_run_id) from run where rn_cycle_id='" & cycleid & "' and rn_test_id='" & testid & "'))))"
Cmd.CommandText=sql
Set Res = Cmd.Execute()
Filedata=Res.Fields.Item("rp_data")
set mstream = CreateObject("ADODB.Stream")
mstream.Type = 1 'adTypeBinary
mstream.Open
mstream.Write Filedata
mstream.SaveToFile "c:\Results.xml",2'
[ 本帖最后由 charles.han 于 2009-1-7 17:41 编辑 ] |
|