Solved

multiuser data access

Posted on 2001-06-14
5
143 Views
Last Modified: 2010-05-02
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
0
Comment
Question by:anishs
  • 3
  • 2
5 Comments
 
LVL 6

Expert Comment

by:andyclap
ID: 6194584
While there's no issue with ADO->ODBC, it all depends on how you implement the data access. With an 80 user system, you'll really need to design the VB app to make sure that you're accessing the data efficiently, network traffic is minimised, and that there's no major locking going on. The best advice I can give without knowing how your VB app is coded is:
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.
0
 

Author Comment

by:anishs
ID: 6198993
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
0
 
LVL 6

Accepted Solution

by:
andyclap earned 100 total points
ID: 6199131
I'd recommend trying a forward only cursor here, as you're just looking once through the records and not updating.
Also,
If rst.RecordCount <= 0 Then
could be replaced by
if rst.eof then
but it's really 6 of one, half a dozen of another.
0
 
LVL 6

Expert Comment

by:andyclap
ID: 6199132
Also, I get the "can't switch to app" message sometimes myself. It's just one of those "live with it and reboot" things.
0
 

Author Comment

by:anishs
ID: 6199387
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
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Introduction I needed to skip over some file processing within a For...Next loop in some old production code and wished that VB (classic) had a statement that would drop down to the end of the current iteration, bypassing the statements that were c…
There are many ways to remove duplicate entries in an SQL or Access database. Most make you temporarily insert an ID field, make a temp table and copy data back and forth, and/or are slow. Here is an easy way in VB6 using ADO to remove duplicate row…
As developers, we are not limited to the functions provided by the VBA language. In addition, we can call the functions that are part of the Windows operating system. These functions are part of the Windows API (Application Programming Interface). U…
Get people started with the process of using Access VBA to control Excel using automation, Microsoft Access can control other applications. An example is the ability to programmatically talk to Excel. Using automation, an Access application can laun…

856 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question