VB.NET MYSQL多个查询

时间:2013-02-16 08:02:26

标签: mysql vb.net

我有使用mysql的vb.net桌面应用程序。我可以毫无问题地远程连接。我有定时器控制,每隔10秒查询一次数据库。现在我想执行多个 不使用多个连接的功能。

Private Sub Timer__Tick()...
    call GET_QUEUED_EMAILS
    call Function2
    Call Function3
End sub

示例功能:

Public Function GET_QUEUED_EMAILS(ByVal sql As String)
    Try
             ' Load From DB
            GlobalFunctions.db_connect()
            Dim reader As New MySqlDataReader
            Dim command As MySqlCommand = connection.CreateCommand()
            command.CommandText = sql

            reader = command.ExecuteReader
            If (reader.HasRows) Then
                While (reader.Read())

                       message_id = reader(0).ToString
                       message_status = reader(2).ToString

                    Exit While
                End While
                reader.Close()
                GlobalFunctions.connection.Close()
               call another function here....
            Else
                reader.Close()
                GlobalFunctions.connection.Close()

            End If
        End If
    Catch ex As Exception
           MessageBox.Show("Error" & ex.Message)
        End Try

End Sub'

1 个答案:

答案 0 :(得分:0)

当第一个计时器结束时,使用三个计时器启动第二个计时器

resp = session.post('https://dummy.dummy.com/api/v1/sessions', data={
    "username": "email",
    "password": "######"
})