停止空结果产生小于无穷大的错误 [英] Stop Null Result producing Less than infinity error
本文介绍了停止空结果产生小于无穷大的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在VB.NET中使用SSH控件编写程序来警告邮件队列是否超过阈值,但是如果结果为NULL则它抛出一个异常并且显示不能该值小于无穷大。
任何人都可以帮助我解决这个问题,因为我是VB.Net的新手?
谢谢
Hi,
I writing a program to alert if a mail queue exceeds a threshold using an SSH control in VB.NET, however if the result if NULL then it throws an exception and displays cannot that value should be less than infinity.
Can anyone shed any light to help me resolve this as I'm new to VB.Net ?
Thanks
Private Function MonitorMAILSERVER()
Dim connInfoMAILSERVER As New Renci.SshNet.PasswordConnectionInfo("MAILSERVER", "username", "password")
Dim sshClientMAILSERVER As New Renci.SshNet.SshClient(connInfoMAILSERVER)
Dim queueMAILSERVER As Renci.SshNet.SshCommand
Using sshClientMAILSERVER
sshClientMAILSERVER.Connect()
queueMAILSERVER = sshClientMAILSERVER.RunCommand("/usr/sbin/postqueue -p | tail -n1 | awk '{print $5}'")
txtMAILSERVER.Text = queueMAILSERVER.Result
sshClientMAILSERVER.Disconnect()
End Using
If queueMAILSERVER.Result >= 20 Then
imgMAILSERVER.Image = Mail_Queue_Monitor.My.Resources.red
Else
imgMAILSERVER.Image = Mail_Queue_Monitor.My.Resources.green
End If
End Function
推荐答案
5}')
txtMAILSERVER.Text = queueMAILSERVER.Result
sshClientMAILSERVER.Disconnect()
结束 使用
如果 queueMAILSERVER.Result> = 20 然后
imgMAILSERVER.Image = Mail_Queue_Monitor.My.Resources.red
<跨度类= 代码关键字>否则跨度>
imgMAILSERVER.Image = Mail_Queue_Monitor.My.Resources.green
结束 如果
结束 功能
5}'") txtMAILSERVER.Text = queueMAILSERVER.Result sshClientMAILSERVER.Disconnect() End Using If queueMAILSERVER.Result >= 20 Then imgMAILSERVER.Image = Mail_Queue_Monitor.My.Resources.red Else imgMAILSERVER.Image = Mail_Queue_Monitor.My.Resources.green End If End Function
这篇关于停止空结果产生小于无穷大的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文