Imports System.Timers
Imports System.Data
Imports System.Data.SqlClient
Imports System.Threading
Imports WAPPUSHLib
Module Module1
    Public Sub Main()

        Dim aTimer As New System.Timers.Timer
        aTimer.BeginInit()
        AddHandler aTimer.Elapsed, AddressOf ReadMyData
        ' Set the Interval to 5 seconds.
        aTimer.Interval = 1000
        aTimer.Enabled = True
        aTimer.EndInit()
        Console.WriteLine("Press 'q' to quit the sample.")
        While Console.Read() <> CInt("q")
        End While
    End Sub
    ' Specify what you want to happen when the Elapsed event is raised.
    Private Sub ReadMyData(ByVal source As Object, ByVal e As ElapsedEventArgs)
        Dim wappush1 As New WapPushClass
        wappush1.BaudRate = 115200
        wappush1.ComPortNo = 1
        wappush1.TimeExpires = 24
        Dim myConnString As String = "server=localhost;database=ceshi_hu;uid=sa;pwd=;"
        Dim myConnection As New SqlConnection(myConnString)
        Dim mySelectQuery As String = "SELECT memo,cellphone,path FROM area where flag=1"
        Dim myCommand As New SqlCommand(mySelectQuery, myConnection)
        myConnection.Open()
        Dim myReader As SqlDataReader
        myReader = myCommand.ExecuteReader()
        ' Always call Read before accessing data.
        While myReader.Read()
            wappush1.PushMessage(myReader("cellphone"), myReader("memo"), myReader("path"))
            Console.WriteLine((myReader("memo") & ", " & myReader("cellphone") & ", " & myReader("path")))
        End While
        ' always call Close when done reading.
        myReader.Close()
        ' Close the connection when done with it.
        myConnection.Close()
    End Sub
End Module



 
											





 
	    

 
	