qtp怎么从数据库中取数据来输入到界面中?
qtp怎么从数据库中取数据来输入到界面中? 用VBS脚本连接数据库,取出值,再输入到你的界面中。 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]