anishs
asked on
multiuser data access
hi..i have created a vb app which is going to be used by multiple users. the vb app is using odbc dsn to access the sql server and ado to retrieve and update data on sql. Around 80 people will be using the vb app. i was wondering if there are any issues/limitations when using odbc and ado in this scenario. Also, iam sometimes getting an error like this when the app loads :
'This action cannot be completed because the other application is busy. Choose 'Switch To' to activate the busy application and correct the problem.'
is this related to ado or problem with focus of the app??
Thanks in advance
'This action cannot be completed because the other application is busy. Choose 'Switch To' to activate the busy application and correct the problem.'
is this related to ado or problem with focus of the app??
Thanks in advance
ASKER
Thanks ..below is the form load code which i believe is the most crucial bit as everytime the app loads (which happens quite a lot). i believe i have done most of what was mentioned above but if theres any other ways to improve it, i would be keen to know. One option iam looking at is use MTS to make it more scalable.
Private Sub Form_Load()
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
'Create the objects for control population
Set con = New ADODB.Connection
Set rst = New ADODB.Recordset
'Open the connection to database
con.Open "DSN=xxx;" & "Uid=xxx;" & "Pwd=xxx;"
' Create a keyset recordset based on the
' table with optimistic locking
Dim strTemp As String
rst.Open "SELECT xxx,xxxx FROM xxx WHERE (xxxx LIKE '[x]')", con, adOpenKeyset, adLockOptimistic
If rst.RecordCount <= 0 Then
rst.Close
con.Close
Set rst = Nothing
Set con = Nothing
strTemp = MsgBox("Sorry No Records were located. Please contact your Systems Administrator for help", 4112, "Error")
lstT.Enabled = False
cboT.Enabled = False
btnExit.Visible = True
btnExit.Enabled = True
Exit Sub
End If
' clear columns
lstT.ColumnHeaders.Clear
lstT.View = lvwReport
' make columns
lstT.ColumnHeaders.Add , , "xxx"
lstT.ColumnHeaders.Add , , "xxxx"
' populate fields
Do Until rst.EOF
strTemp = Format(rst("xxx"), "###,###,##0")
Set mitem = lstT.ListItems.Add(, , String(11 - Len(strTemp), " ") & strTemp)
mitem.SubItems(1) = rst.Fields("xxx")
If Not IsNull(rst("xxx") & ("xxx")) Then
cboT.AddItem Trim$(rst("xxx") & " - " & rst("xxx"))
rst.MoveNext
End If
Loop
cboT.AddItem ("")
'autosize column headers
Dim col2adjust As Long
For col2adjust = 0 To lstT.ColumnHeaders.Count - 1
Call SendMessage(lstT.hWnd, LVM_SETCOLUMNWIDTH, col2adjust, ByVal LVSCW_AUTOSIZE)
Next
'enable full row selection
LVFullRowSelect lstT
'set columns flat
flatheaders
rst.Close
con.Close
Set rst = Nothing
Set con = Nothing
End Sub
Private Sub Form_Load()
Dim con As ADODB.Connection
Dim rst As ADODB.Recordset
'Create the objects for control population
Set con = New ADODB.Connection
Set rst = New ADODB.Recordset
'Open the connection to database
con.Open "DSN=xxx;" & "Uid=xxx;" & "Pwd=xxx;"
' Create a keyset recordset based on the
' table with optimistic locking
Dim strTemp As String
rst.Open "SELECT xxx,xxxx FROM xxx WHERE (xxxx LIKE '[x]')", con, adOpenKeyset, adLockOptimistic
If rst.RecordCount <= 0 Then
rst.Close
con.Close
Set rst = Nothing
Set con = Nothing
strTemp = MsgBox("Sorry No Records were located. Please contact your Systems Administrator for help", 4112, "Error")
lstT.Enabled = False
cboT.Enabled = False
btnExit.Visible = True
btnExit.Enabled = True
Exit Sub
End If
' clear columns
lstT.ColumnHeaders.Clear
lstT.View = lvwReport
' make columns
lstT.ColumnHeaders.Add , , "xxx"
lstT.ColumnHeaders.Add , , "xxxx"
' populate fields
Do Until rst.EOF
strTemp = Format(rst("xxx"), "###,###,##0")
Set mitem = lstT.ListItems.Add(, , String(11 - Len(strTemp), " ") & strTemp)
mitem.SubItems(1) = rst.Fields("xxx")
If Not IsNull(rst("xxx") & ("xxx")) Then
cboT.AddItem Trim$(rst("xxx") & " - " & rst("xxx"))
rst.MoveNext
End If
Loop
cboT.AddItem ("")
'autosize column headers
Dim col2adjust As Long
For col2adjust = 0 To lstT.ColumnHeaders.Count - 1
Call SendMessage(lstT.hWnd, LVM_SETCOLUMNWIDTH, col2adjust, ByVal LVSCW_AUTOSIZE)
Next
'enable full row selection
LVFullRowSelect lstT
'set columns flat
flatheaders
rst.Close
con.Close
Set rst = Nothing
Set con = Nothing
End Sub
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Also, I get the "can't switch to app" message sometimes myself. It's just one of those "live with it and reboot" things.
ASKER
thanks..i have asked the 'cant switch to app' error to couple people and their responses have been different. some responses were:
"bug with ado"
"another app is trying to take focus at same time"
"a problem with sendmessage code, i should be using callback"
anyways, i will probably use a 3 tier architecture with mts in the next revision of the program which i hope will fix couple of issues especially scalability issues.
Cheers
"bug with ado"
"another app is trying to take focus at same time"
"a problem with sendmessage code, i should be using callback"
anyways, i will probably use a 3 tier architecture with mts in the next revision of the program which i hope will fix couple of issues especially scalability issues.
Cheers
1) No data bound controls. They really bring multiuser systems to their knees.
2) Optimistic locking using timestamps for integrity
3) Use explicit SQL execute statements for deta modifications rather than updatable recordsets
4) Use stored procedures to do processing on the server where possible
5) Think carefully about data modifications within transactions to take accout of locking
6) Make sure your database is well designed with a good index strategy to prevent bottlenecks on the server.
80 users is close to my personal preference for SQL Server on a standard 1 CPU DB Server, at this volume you really have to be careful with locking etc.