QTP链接数据库
上一篇 /
下一篇 2009-03-27 17:51:31
/ 个人分类:QTP脚本
*********************************************************
'连接数据库
'*********************************************************
Dim conn,res,strSql ,strSqll ,numbe '定义变量
On error resume next
set conn = CreateObject("ADODB.Connection") '创建连接
conn.ConnectionString="Provider=MSDAORA.1;Password=Password;Persist Security Info=True;User
ID=id;Data Source=192.168.0.1:****/source;" '设置连接字符串
conn.open '开启连接
If conn.state=0 Then '如果连接状态为0,表示连接失败,写入reporter对象中,否则表示连接成功
Reporter.ReportEvent micFail,"testing","数据库连接失败"
res.close '关闭结果集和连接,并且置为空
Set res = nothing
conn.close
Set conn = nothing
else
Reporter.ReportEvent micPass,"testing","数据库连接成功"
收藏
举报
TAG: