类型不匹配: '[string
'Dim URLDim linkStatue
Dim linktime
URL="wenku.baidu.com"
Set control=CreateObject("HttpWatch.Controller")
Set plugin=control.IE.New()
plugin.Log.EnableFilter(false)
plugin.Clear()
plugin.Record()
plugin.GotoURL(URL)
wait(2)
ip = plugin.log.Entries.Item(0).ServerIP '获取iP地址
code = plugin.Log.Entries.Item(0).StatusCode '获取状态码
linktime = plugin.log.Entries.Summary.Time '获取响应时间
'inputbox(linktime)
Dim Conn
Set Conn=CreateObject("ADODB.Connection") '创建连接
Const ConnectionString="Driver={Mysql ODBC 5.1 Driver};DATABASE=shanxiyidong;PWD=sa;PORT=3306;SERVER=127.0.0.1;UID=root"
Conn.Open ConnectionString
'连接数据库_增删改
Dim strSql,i,a '定义变量
strSql= "insert into zhangting(测试号码) values ('15112341234')" '设置插入语句
Conn.Execute strSql '执行SQL语句
If 10>linktime Then
Reporter.ReportEvent micPass,"响应时间","少于10秒:"&linktime
else
Reporter.ReportEvent micFail,"响应时间","大于10秒:"&linktime
End If
strSql= "insert into zhangting(受理时长) values('"+linktime+"')" '设置插入语句
'strSql= "update zhangting set 受理时长='"+linktime+"' where 测试号码='15112341234'" '修改编号
Conn.Execute strSql '执行SQL语句
'停止记录Http底层数据
plugin.Stop
'关闭浏览器窗口
plugin.CloseBrowser()
'回收对象
Set control=nothing
Set plugin=nothing
Set sumary=nothing
''''''
'''''strSql= "insert into zhangting(受理时长) values('"+linktime+"')" '设置插入语句
运行到这句时报错“类型不匹配: ''”但是linktime换成输出ip的时候又可以通过了 linktime = plugin.log.Entries.Summary.Time 你这个是时间类型吧
表结构里这里是char的,当然不行了。String.valueOf(linktime)一下,具体VB语句查VB的手册。
页:
[1]