ssh renci的问题 [英] Problem with ssh renci

查看:83
本文介绍了ssh renci的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好



我需要执行一次以上的命令,所以我的VB.NET循环代码有问题:



client.Connect()

Dim cmd As SshCommand

Dim result As String

cmd = client .CreateCommand(comand)



for i As Integer = 1 to 10

rezultat = cmd.Execute()

msgBox(rezultat)

下一页



client.disconnect()



我认为这个命令cmd.execute让我失望了,所以一个解决方案是放置client.connect,但我认为它没有效果。



你能帮助我吗....

解决方案

这是一个SQL客户端连接。因此,您可以根据SshCommand采用读者的想法并实施。





 私有  Sub  Button1_Click( ByVal  sender 作为系统。对象 ByVal  e  As  System.EventArgs)句柄 Button1.Click 
如果 oCn。 State = ConnectionState.Closed 然后
oCn.Open()
结束 如果

Dim oRead As SqlClient.SqlDataReader = Nothing

Dim cmd SqlClient.SqlCommand( 来自mst_scheme的SELECT * ,oCn)

尝试
oRead = cmd.ExecuteReader
If oRead.HasRows 然后
while oRead.Read( )
MsgBox(oRead( 0 ))
结束 while
结束 如果
Catch ex As 异常
MsgBox(ex.Message)
最后
oRead.Close()
oCn.Close()
结束 尝试

结束 Sub
结束


Hello

I need to execute a command more than one times, so i have a problem in my VB.NET loop code:

client.Connect()
Dim cmd As SshCommand
Dim result As String
cmd = client.CreateCommand("comand")

For i As Integer = 1 To 10
rezultat = cmd.Execute()
msgBox(rezultat)
Next

client.disconnect()

I figure that this command cmd.execute disconect me, so one solution is to put client.connect but I think it is not effective.

Can you help me, please....

解决方案

This is a SQL Client connectivity. So you can take an Idea of reader and implement according SshCommand.


Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If oCn.State = ConnectionState.Closed Then
            oCn.Open()
        End If

        Dim oRead As SqlClient.SqlDataReader = Nothing

        Dim cmd As New SqlClient.SqlCommand("SELECT * from mst_scheme", oCn)

        Try
            oRead = cmd.ExecuteReader
            If oRead.HasRows Then
                While oRead.Read()
                    MsgBox(oRead(0))
                End While
            End If
        Catch ex As Exception
            MsgBox(ex.Message)
        Finally
            oRead.Close()
            oCn.Close()
        End Try

    End Sub
End Class


这篇关于ssh renci的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆