T
Tommy Malone
I have an application that uses a web service to check for user updates
before calling more extensive code to sync data. My question is, how is
concurrency handled, if concurrency should even be my concern, where many
users call the same web service to check the same database (although each
user will have user-specific data not shared by other users) for changes? In
other words, am I going to run into trouble when a hundred users hit the
"User" table for a HasChanges value every minute? Is there another,
preferred strategy to communicate that there are db changes that need to be
downloaded? What happens to this code when it gets called at the same time
with two different users?
<WebMethod(CacheDuration:=3600)> Public Function Ping(ByVal UserName As
String) As Boolean
Dim datareader As SqlClient.SqlDataReader
Dim cmdUserChanges As New SqlClient.SqlCommand("SELECT HasChanges FROM
MohawkUsers WHERE UserName = '" & UserName & "'", connMohawk)
Try
connMohawk.Open()
datareader = cmdUserChanges.ExecuteReader
While datareader.Read
Ping = datareader.Item(0)
End While
connMohawk.Close()
Catch ex As Exception
Finally
connMohawk.Close()
End Try
End Function
before calling more extensive code to sync data. My question is, how is
concurrency handled, if concurrency should even be my concern, where many
users call the same web service to check the same database (although each
user will have user-specific data not shared by other users) for changes? In
other words, am I going to run into trouble when a hundred users hit the
"User" table for a HasChanges value every minute? Is there another,
preferred strategy to communicate that there are db changes that need to be
downloaded? What happens to this code when it gets called at the same time
with two different users?
<WebMethod(CacheDuration:=3600)> Public Function Ping(ByVal UserName As
String) As Boolean
Dim datareader As SqlClient.SqlDataReader
Dim cmdUserChanges As New SqlClient.SqlCommand("SELECT HasChanges FROM
MohawkUsers WHERE UserName = '" & UserName & "'", connMohawk)
Try
connMohawk.Open()
datareader = cmdUserChanges.ExecuteReader
While datareader.Read
Ping = datareader.Item(0)
End While
connMohawk.Close()
Catch ex As Exception
Finally
connMohawk.Close()
End Try
End Function