软件测试工具robot里连接数据库的例子

发表于:2009-12-17来源:作者:点击数: 标签:
软件测试工具 robot 里连接 数据库 的例子 Sub Main Dim Result As Integer dim strconn as string dim conn as Object dim rs as Object dim testnumber1 as integer dim testnumber2 as integer 'Initially Recorded: 2006-3-27 11:14:23 'scrīpt Name: a

 

软件测试工具robot里连接数据库的例子

clearcase/" target="_blank" >cccccc cellSpacing=0 cellPadding=1 width="80%" align=center bgColor=#ffffff border=1 heihgt="">

        Sub Main
            Dim Result As Integer
            dim strconn as string
            dim conn as Object
            dim rs as Object
            dim testnumber1 as integer
            dim testnumber2 as integer
            'Initially Recorded: 2006-3-27  11:14:23
            'scrīpt Name: ado
            on error goto qq
            StartApplication "C:\WINNT\system32\calc.exe"
            Window SetContext, "Caption=计算器", ""
            strconn="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\ado.mdb;Persist Security Info=False"
            set conn=createobject("ADODB.Connection")
            conn.open strconn
            set rs=createobject("ADODB.Recordset")
            rs.open "select number1,number2 from test\", conn
            rs.MoveFirst
            Window SetContext, "Caption=计算器", ""
            do while not rs.eof
               testnumber1=rs.fields(0).value
               testnumber2=rs.fields(1).value
               msgbox testnumber1
               msgbox testnumber2
               inputkeys str(testnumber1)
               inputkeys "{+}"
               inputkeys str(testnumber2)
               inputkeys "{=}"
               rs.MoveNext
            loop
            Window CloseWin, "", ""
            rs.close
            conn.close
            set rs=nothing
            set conn=nothing
            exit sub
        qq:
         resume          '恢复到出错位置下一个记录
        End Sub

原文转自:http://www.ltesting.net

评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)