Click here to Skip to main content
15,891,843 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Hi! I have a queuing system that is in development, I have a server and five workstations those WS are controlling the queuing window that displays the number next in line. Now I'm having a problem with the queuing system, whenever a controller clicks the "next" button the server does not respond to any of the workstations. My question is how can I somehow " refresh" the form that'll make the latest customer in line appear on the queuing window. Thanks!

I'm currently using VS2012 and SQLServer2014.

the code below is the what I have tried:

What I have tried:

Private Sub Timer7_Tick(sender As Object, e As EventArgs) Handles Timer7.Tick
    Timer7.Interval = 5000
    Timer7.Enabled = True
    Try
        Dim scn As New SqlConnection
        Dim scm As New SqlCommand
        Dim str1 As String
        str1 = "Server=MISKRISTIAN-PC\HMO_OPD;Database=HMO_OPD_QUEUE;User Id=sa;Password=sa;"
        scn.ConnectionString = str1
        scm.Connection = scn
        scn.Open()
        scm.CommandText = "SELECT * from ConCon"
        scm.CommandText = "SELECT * from AppCon"
        scm.CommandText = "SELECT * from PrioCon"
        scm.CommandText = "SELECT * from RetCon"
        scm.ExecuteNonQuery()
        scn.Close()
    Catch ex As Exception
        MessageBox.Show(ex.Message)
    End Try

    Refresh()

End Sub
Posted
Comments
CHill60 27-Nov-17 5:19am    
The only command from your code that could possibly be executed is the "SELECT * from RetCon" ...
How are you populating your window in the first place?
Oh - and stop using sa and definitely don't publish your password on an open site!
noob_noob 27-Nov-17 20:13pm    
Can you give me an idea that can execute all four of them?
The system populates the window by calling the data that was generated when a user clicks a button that generates a ticket from the system.

this system does not generate sensitive information, there is nothing to worry about that.
CHill60 28-Nov-17 4:04am    
"Can you give me an idea that can execute all four of them?" - er...try using scm.ExecuteNonQuery() for each of them.
"The system populates the window ..." - How! The code! If you can populate the window once then you should be able to refresh it by re-using at least some of the code
"this system does not generate sensitive information, there is nothing to worry about that." - I am not worried, but you ought to be. You have given hackers all they need to know to compromise your system, pretend to be you, delete your database, etc etc etc
noob_noob 29-Nov-17 3:01am    
Private Sub AppNxt_Click(sender As Object, e As EventArgs) Handles AppNxt.Click
        'next
        Dim strHostName1 As String
        strHostName1 = System.Net.Dns.GetHostName()

        If (wapp.Text = 0) Then
            MessageBox.Show("There are no queues as of now!")

        ElseIf (Queue.Label7.Text < FrmNumApp.NumApp.Text) Then
            Dim sqlconn5 As New SqlConnection
            Dim sqlquery5 As New SqlCommand
            Dim connString5 As String
            wapp.Text = CStr(CDbl(wapp.Text) - 1)
            Try
                connString5 = "Server=MISKRISTIAN-PC\HMO_OPD;Database=HMO_OPD_QUEUE;User Id=sa;Password=sa;"
                sqlconn5.ConnectionString = connString5
                sqlquery5.Connection = sqlconn5
                sqlconn5.Open()
                sqlquery5.CommandText = "INSERT INTO AppCon([Number],[Counter])VALUES(@Number,@Number)"
                sqlquery5.Parameters.AddWithValue("@Number", Queue.Label7.Text)
                sqlquery5.Parameters.AddWithValue("@Counter", Queue.Label19.Text)
                sqlquery5.ExecuteNonQuery()
                sqlconn5.Close()
            Catch ex As Exception
                MessageBox.Show(ex.Message)
            End Try

            Queue.Label7.Text = CStr(CDbl(Queue.Label7.Text) + 1)
            Queue.Label11.Text = "0"
            My.Computer.Audio.Play(My.Resources.DoorBell, AudioPlayMode.Background)
            Dim speaker As New SpeechSynthesizer()
            Dim speak As New Prosody()
            'tts
            speak.Duration = 3
            speaker.Rate = -5
            speaker.Volume = 100
            speaker.Speak("Now serving number " + Queue.Label7.Text)
            speaker.SelectVoiceByHints(VoiceGender.Male)
            Queue.Label19.Text = strHostName1
        End If

    End Sub


this is the function of the "next button"
noob_noob 29-Nov-17 3:10am    
the function saves data in the database,and displays the data on the form named Queue(this is the form that displays the number that is being served).

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900