|
本帖最后由 yidao8808 于 2011-8-22 13:57 编辑
Dim Cnn
Dim Rst
Dim strCnn
Set Cnn = CreateObject("ADODB.Connection")
Set Rst =CreateObject("ADODB.Recordset")
strCnn="provider=OraOLEDB.Oracle.1;Data Source=192.168.10.8/aurora;password=xxx;User ID=xxx; Security Info=True;"
Cnn.Open strCnn
If Cnn.State=0 Then
Reporter.ReportEvent micFail,"testing","数据库连接失败"
else
Reporter.ReportEvent micPass, "testing","数据库连接成功"
End If
If Cnn.State<>0 Then
strsql="select * from pets"
Rst.Open strsql,Cnn
i=1
Do While Not Rst.eof
msg=Rst("name")
'将pets表中的name列导入到datatable,Action1表的name列
Datatable.GetSheet("Action1").GetParameter("name").ValueByRow(i) = msg
'游标移动,指向下行记录
Rst.MoveNext
i=i+1
Loop
Rst.Close
Cnn.Close
Set Rst=nothing
Set cnn=nothing
End If
运行完毕,查看results,
|
|