51Testing软件测试论坛
标题:
qtp怎么从数据库中取数据来输入到界面中?
[打印本页]
作者:
long-run
时间:
2008-11-12 09:19
标题:
qtp怎么从数据库中取数据来输入到界面中?
qtp怎么从数据库中取数据来输入到界面中?
作者:
happychap
时间:
2008-11-12 09:20
用VBS脚本连接数据库,取出值,再输入到你的界面中。
作者:
Old々Man
时间:
2008-11-28 17:03
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 = "
rovider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\DataDrivenCalc\sogoucalc.mdb
ersist Security Info=False"
strCnn = "
rovider=Microsoft.Jet.OLEDB.4.0;Data Source=" & filepath & "
ersist 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
欢迎光临 51Testing软件测试论坛 (http://bbs.51testing.com/)
Powered by Discuz! X3.2