long-run 发表于 2008-11-12 09:19:20

qtp怎么从数据库中取数据来输入到界面中?

qtp怎么从数据库中取数据来输入到界面中?

happychap 发表于 2008-11-12 09:20:14

用VBS脚本连接数据库,取出值,再输入到你的界面中。

Old々Man 发表于 2008-11-28 17:03:51

Public Function ReadDB(ByVal filepath)
        '---- CursorTypeEnum Values ----
        Const adOpenForwardOnly = 0
        Const adOpenKeyset = 1
        Const adOpenDynamic = 2
        Const adOpenStatic = 3        
        '---- LockTypeEnum Values ----
        Const adLockReadOnly = 1
        Const adLockPessimistic = 2
        Const adLockOptimistic = 3
        Const adLockBatchOptimistic = 4

        Dim cnn,rst,strCnn,strSql
        Dim strEachLine,myArr,rValue       
        'strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataDrivenCalc\sogoucalc.mdb;Persist Security Info=False"
        strCnn = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filepath & ";Persist Security Info=False"       
        Set cnn = CreateObject("ADODB.Connection")
        Set rst = CreateObject("ADODB.Recordset")
        strSql = "select * from Calc"
        cnn.Open strCnn
        rst.CursorType = adOpenForwardOnly
        rst.LockType = AdLockOptimistic
        rst.Open strSql,cnn
        rst.MoveFirst
        Do While Not rst.EOF
                'Msgbox rst.Fields("Test Case")
                strEachLine = Trim(rst.Fields("Test Case"))
                rst.MoveNext
        Loop
页: [1]
查看完整版本: qtp怎么从数据库中取数据来输入到界面中?