QTP 依次读取文本中的各行数据

来源:互联网 发布:78团淘宝兼职是真的吗 编辑:程序博客网 时间:2024/05/19 23:17
Dim strarray(1000)Dim i i=0Set fso = CreateObject("Scripting.FileSystemObject")Set openfile=fso.OpenTextFile("C:/TP131205KF.TXT",1,True)Do          Until openfile.AtEndOfStream              strarray(i)=openfile.ReadLinemsgbox strarray(i)    ‘加到这里就能显示             i=  i+1    Loopopenfile.CloseSet fso=Nothing
Dim adoconn
set adoconn=Createobject("adodb.connection")
connectionstr=""   '数据库连接字符串
adoconn.open connectionstr
set amd=createobject("adoconn.command")
amd.ActiveConnection=connectionstr
for j=0 to i-1
amd.commandText=strarry(j)
amd.command Type=1 'command Type 为1是sql查询,4为sql存储
set adorst=adoconn.Execute()
Next
                                             
1 0