Click here to Skip to main content
15,891,828 members
Please Sign up or sign in to vote.
1.44/5 (2 votes)
See more:
Hi! I'm developing a queuing system and I'm having trouble with how can I sync the queuing server with my workstations whenever they call for the customer who is next in line. The database works fine, everyone can see it, everyone saves data in it. The only problem is, whenever a workstation calls for a customer it doesn't show on the queue window that is directly connected to the server, it's like they have separate programs running with only one database to save at. My superior suggested that I use a timer but how can I implement a timer on the system?

I'm currently using VS2012 and SQL2014.

What I have tried:

haven't tried anything yet. Thanks for the help!
Posted
Updated 28-Nov-17 7:46am

Put a Timer control on the form, set it to Enabled (Enabled=TRUE), set an interval (5 seconds, or whatever), and handle the Tick event.
 
Share this answer
 
Comments
noob_noob 23-Nov-17 3:19am    
Hi, thanks for replying to my question. I did some fiddling with the tick event and this is what I ended up with:

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

this is wrong in so many ways but I'm on a deadend here. Can you help me? Thanks.
You have
SELECT * from RetCon"
repeatedly. In the first place, one is enough. In the second, since your query returns a result set, you need to open a DataReader.
 
Share this answer
 

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