51Testing软件测试论坛

标题: qtp从QC中取出Blob类型的数据报错 [打印本页]

作者: charles.han    时间: 2009-1-7 11:00
标题: qtp从QC中取出Blob类型的数据报错
Set tdc = QCUtil.TDConnection
Set com = tdc.Command

sql="select rp_data  from REPOSITORY where rp_id=5916" 'rp_data为Blob

com.CommandText = sql

Set Testrecordset = com.Execute '执行时候报错,没有具体的错误信息。

求助高手,如何读取oracle 数据库中的Blob 文件
作者: charles.han    时间: 2009-1-7 17:39
标题: 用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 编辑 ]




欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/) Powered by Discuz! X3.2