Rss & SiteMap

Foxtable(狐表) http://www.foxtable.com

新一代数据库软件,完美融合Access、Foxpro、Excel、vb.net之优势,人人都能掌握的快速软件开发工具!
共2 条记录, 每页显示 10 条, 页签: [1]
[浏览完整版]

标题:关于trycatch的问题

1楼
benben325 发表于:2024/2/27 9:50:00
我做了个函数,用来测试是否能联通某个后台,如下所示:

Dim api As String = Args(0)
Dim url As String = "http://192.168.5.210:32177/" & api
Dim hp As New HttpClient(url)
hp.Timeout = 3
Dim s As String = ""
Try
    s = hp.GetData()
Catch ex As Exception 
    s = ""
End Try
If s > "" Then
    Return 1
Else
    Return 0
End If

可是即使用了trycath但,还是跳出错误,rt所示:

图片点击可在新窗口打开查看此主题相关图片如下:123.png
图片点击可在新窗口打开查看

2楼
有点蓝 发表于:2024/2/27 9:56:00
http://www.foxtable.com/mobilehelp/topics/0294.htm

Dim api As String = Args(0)
Dim url As String = "http://192.168.5.210:32177/" & api
Dim hp As New HttpClient(url)
hp.SkipError = True
hp.Timeout = 1
Dim s As String = hp.GetData()
if hc.StatusCode = 200 andalso s > ""then
    Return 1
Else
    Return 0
End If

共2 条记录, 每页显示 10 条, 页签: [1]

Copyright © 2000 - 2018 foxtable.com Tel: 4000-810-820 粤ICP备11091905号

Powered By Dvbbs Version 8.3.0
Processed in .01563 s, 2 queries.