本文介绍了客户端-服务器应用程序VB.Net 2008的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在开发一个应用程序,其数据库将存储在服务器计算机上,并且客户端将访问该数据库.以下是我用于从数据库检索数据的代码.
Hi,
I am working on an application whose data base will be stored on a server computer and the clients will be accessing that db. Following is the code which i use to retrieve data from data base.
Protected Function ExecuteDQL(ByVal Query As String) As DataSet
DS = New DataSet
DBCom = DBCon.CreateCommand()
DBAdp = New SqlDataAdapter
Try
DBCom.CommandText = Query
DBCom.Connection = DBCon
DBAdp.SelectCommand = DBCom
DBAdp.Fill(DS)
If DS.Tables(0).Rows.Count >= 1 Then
Return DS
Else
Return Nothing
End If
Catch ex As Exception
MsgBox(ex.Message)
Return Nothing
Finally
CloseDB()
End Try
End Function
我对此代码有些困惑.让我们假设3个用户一次访问相同的数据,其中一个用户同时更改数据.然后其他2个用户将处理旧数据,而不是新数据.关于此的任何建议/解决方案请告诉我.
Thankx
I have a little confusion about this code. Lets assume 3 users access same data at a time and one of them changes data meanwhile. Then other 2 users will be dealing with the old data not the new one. Any suggestion/solution about this please do tell me.
Thankx
推荐答案
这篇关于客户端-服务器应用程序VB.Net 2008的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!