标题: 对QTP语法不熟,这句老报错,请帮忙调试一下~· [打印本页] 作者: magiexj 时间: 2010-2-11 16:04 标题: 对QTP语法不熟,这句老报错,请帮忙调试一下~· sqlRordset=select
Substring(ai_nextowner,Patindex('%(%',ai_nextowner)+1,Patindex('%)%',ai_nextowner)-Patindex('%(%',ai_nextowner)-1) as nextLoginName
,ai_approveType,wf_currentStep,ai_requirementNo
from RRD_ApplyInfo as RRD_AI
left join WF_WorkFlow as WF_WF on RRD_AI.ai_applyid=WF_WF.wf_FormID
where 1=1
and ai_flag=0
and wfc_id=17
and AI_RequirementNO ='2010020019'作者: magiexj 时间: 2010-2-11 16:05 标题: 我是直接从SQL编辑器里拷贝过来的语句,有单引号 我是直接从SQL编辑器里拷贝过来的语句,有单引号,不知道该怎么处理这个字符串作者: magiexj 时间: 2010-2-11 16:59 标题: 能直接帮忙修改一下么,刚刚学,不太会~~调了半天,还是懵懂 sqlRordset=select
Substring(ai_nextowner,Patindex('%(%',ai_nextowner)+1,Patindex('%)%',ai_nextowner)-Patindex('%(%',ai_nextowner)-1) as nextLoginName
,ai_approveType,wf_currentStep,ai_requirementNo
from RRD_ApplyInfo as RRD_AI
left join WF_WorkFlow as WF_WF on RRD_AI.ai_applyid=WF_WF.wf_FormID
where 1=1
and ai_flag=0
and wfc_id=17
and AI_RequirementNO ='2010020019'作者: magiexj 时间: 2010-2-11 17:07 标题: 在QTPl里写了这个,语法报错~~ '建立数据库连接
Dim Cnn,Rst,strCnn,sqlRordset,RequirementNO
Set RequirementNO="2010020019"
strCnn= "DRIVER=SQL Server;SERVER=10.28.10.46;UID=saWD=123@abc;APP=QuickTest
P
rofessional;WSID=ISS110301000144;DATABASE=PSARRD_Test“
Set Cnn= CreateObject("ADODB.Connection")
Cnn.OpenstrCnn
Set Rst= CreateObject("ADODB.Recordset")
'记录集
sqlRordset=select
Substring(ai_nextowner,Patindex('%(%',ai_nextowner)+1,Patindex('%)%',ai_nextowner)-Patindex('%(%',ai_nextowner)-1) as nextLoginName
,ai_approveType,wf_currentStep,ai_requirementNo
from RRD_ApplyInfo as RRD_AI
left join WF_WorkFlow as WF_WF on RRD_AI.ai_applyid=WF_WF.wf_FormID
where 1=1
and ai_flag=0
and wfc_id=17
and AI_RequirementNO ='2010020019'
Rst.Open sqlRordset,Cnn
Rst.MoveFirst
Do While Not Rst.EOF
MsgBoxTrim(Rst.Fields("TestResult"))
Rst.MoveNext
Loop
Rst.Close
Cnn.Close
Set Rst= Nothing
Set Cnn= Nothing