Question

ado multiuser database app

Asked by: morgantop

ok, after coding a db application using ado components for a while, my boss desided it should be
a multiuser db. meaning 2-3 clients should work on the same mdb file (on the network)
how to quickly (or slowly) convert change this app to safley support multiusers?
changing only cursor types/location? any insites with this issue?
anyone wrote true multiuser db application with ado....?


please help me out.
thanks.

This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.

Subscribe now for full access to Experts Exchange and get

Instant Access to this Solution

  • Plus...
  • 30 Day FREE access, no risk, no obligation
  • Collaborate with the world's top tech experts
  • Unlimited access to our exclusive solution database
  • Never be left without tech help again

Subscribe Now

Asked On
2003-06-15 at 11:45:59ID20648817
Tags

ado

Topic

Delphi Programming

Participating Experts
7
Points
250
Comments
18

Trusted by hundreds of thousands everyday for fast, accurate and reliable tech support.

  • "The time we save is the biggest benefit of Experts Exchange to Warner Bros. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange." Mike Kapnisakis, Warner Bros.
  • "Our team likes having a resource that is more secure than just using Google and most experts using this service really know their stuff. It's nice to look here first versus using Google." Dayna Sellner, Lockheed Martin
  • "Anytime that I've been stumped with a problem, 9 out of 10 times Experts Exchange has either the accepted solution or an open discussion of the potential solution to the problem." Kenny Red, eBay Inc.

See what Experts Exchange can do for you.

Got a question?

We've got the answer.

Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.

Screenshot of Experts Exchange Knowledgebase

Need individual assistance?

Our experts are ready to help.

If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.

Screenshot of Experts Exchange Knowledgebase

Want to learn from the best?

Read articles from industry experts.

Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.

Screenshot of an Article

Working on a long term project?

Store your work and research.

Save solutions to your questions, answers you’ve discovered through searching plus helpful articles in your personal knowledgebase for easy future access.

Screenshot of Experts Exchange Knowledgebase

Access the answers to your technology questions today.

Subscribe Now

30-day free trial. Register in 60 seconds.

What Makes Experts Exchange Unique?

Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Trusted by the world's most respected brands.

image of each brand's logo

Faithfully serving IT professionals since 1996.

Experts Exchange Logo

Try it out and discover for yourself.

Subscribe Now

30-day free trial. Register in 60 seconds.

Related Solutions

  1. connect .mdb by ADO and ODBC
    I want to try ODBC and ADO. Can you give me a step by step instruction showing how to connect a mdb file? (from get a refrence, if any, to create a recordset) Thank you in advance. Victor
  2. SQL in ADO
    Hi, I usually use ADO connecting it to Tables in Access mdb files. How can I use SQL statement(s) in ADO please tell me the steps and code used. Thanks
  3. ADO and DECISIONCUBE
    Hi, I have an ado connectionstring linked to a MDB database with delphi5. I search to connect decisioncube, decisionquery component to MDB ADO table. How to do ? Thanks

Free Tech Articles

  1. WARNING: 5 Reasons why you should NEVER fix a computer for free.
    It is in our nature to love the puzzle. We are obsessed. The lot of us. We love puzzles. We love the challenge. We thrive on finding the answer. We hate disarray. It bothers us deep in our soul. W...
  2. SCCM OSD Basic troubleshooting
    SCCM 2007 OSD is a fantastic way to deploy operating systems, however, like most things SCCM issues can sometimes be difficult to resolve due to the sheer volume of logs to sift through and the dispe...
  3. Migrate Small Business Server 2003 to Exchange 2010 and Windows 2008 R2
    This guide is intended to provide step by step instructions on how to migrate from Small Business Server 2003 to Windows 2008 R2 with Exchange 2010. For this migration to work you will need the fo...
  4. Create a Win7 Gadget
    This article shows you how to create a simple "Gadget" -- a sort of mini-application supported by Windows 7 and Vista. Gadgets can be dropped anywhere on the desktop to provide instant information, ...
  5. Outlook continually prompting for username and password
    There have been a lot of questions recently regarding Outlook prompting for a username and password whilst using Exchange 2007. There are a few reasons why this would happen and I will try to cover t...
  6. Backup Exchange 2010 Information Store using Windows Backup
    There seems to be quite a lot of confusion around the ability to backup Exchange 2010 using the built in Windows Backup feature. This stems from the omission of this feature prior to Exchange 2007 s...

Cloud Class Webinars

  1. Avoiding Bugs in Microsoft Access
    Alison Balter takes and in-depth look at avoiding bugs in Access. In this webinar you will learn about using the immediate window to debug your applications, invoking the debugger, using breakpoints to troubleshoot, stepping through code, setting the next statement to execute, ...
  2. Top 10 Best New Features in Visio 2010
    Scott Helmers gives live demonstrations of the top 10 new features in Visio 2010. This webinar will teach you how to create compelling diagrams by adding shapes to the page with a single click, linking the shapes in a diagram to data in Excel (or SQL Server, or SharePoint), ...
  3. IT Consultant Business Secrets Revealed
    Michael Munger, Experts Exchange tech pro and IT consultant, pulls back the curtain on his very successful businesses and answers question on every IT consultant and business owner should know about. He shares secrets on what he did to solve the 5 most common problems in IT, ...
  4. Disaster Recovery and Business Continuity
    Quest CTO, Mike Billon, gives an overview of the steps involved in building a dunamic disaster recovery plan. Through case studies and an examination of software/hardware tooles for monitoring and testing, you'll gain a better understandin of where you are, where you want ...
  5. Organize Your Visio Diagrams with Containers and Lists
    Scott Helmers uses cross functional flowcharts, wireframe diagrams, data graphic legends and seating charts to teach you: how to ustilize all three new structured diagram components in Visio 2010, the best practices for organizeing shapes in previous version of Visio, how to organize ...
  6. How to Us Objects, Properties, Events and Methods in Microsoft Access
    Alison Dalter gives an in-depbth look at objects, properties, events and methods in Microsoft Access. In this webinar you will learn about using the object browser, referring to objects, working with properties and methods, working with object variables, understanding the ...

Join the Community

Give a Little. Get a Lot.

Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.

Join the Community

Answers

 

by: Workshop_AlexPosted on 2003-06-15 at 14:52:41ID: 8728166

Access, eh?

Start using SQL Server and/or start thinking about using transactions.
And yes, I wrote multi-user ADO applications. But basically, you let ADO handle most of the multi-user part.

My advise? Test how the application works in it's current state with multiple users. See if you can get any conflicts and how Delphi responds to this. Spend about a week testing...

 

by: morgantopPosted on 2003-06-15 at 16:08:47ID: 8728403

hi Alex,
actually i do use transactions (with my SQL statements).
I annot use SQL Server, sorry :)
with other db aware comonents i cannot use transactions. such as dbgrids.
"you let ADO handle"...
don't think ADO will handle it, unless u tell him how to handle it (ie: cursor types/location)
what happens if a nother user deletes a record i'm currently working on, and so on?
if i delete a record in my application, access will imidiatly "see" that the record was deleted...
I will inc points for a good and persise explanation.
code will be appreteated also.

 

by: 123456Posted on 2003-06-15 at 16:43:17ID: 8728490

hi, i see a question that similar with your question last week

the link is
https://www.experts-exchange.com/Programming/Programming_Languages/Delphi/Q_20583310.html

may be help you

regards
hamid reza

 

by: morgantopPosted on 2003-06-15 at 18:45:40ID: 8728789

reza,
thanks,
but i allready know that.

 

by: mocartsPosted on 2003-06-16 at 02:33:01ID: 8730527

first you should decide what sharing startegy you want to use.
Optimistic - normally one user works with one row of data and no lock is requiered to prevent other user from update/delete that row
Pesimistic - that's very often that multiple users want to work with one row simultaneously - you should lock that row (with help of ADO (LockType := ltPesimistic and writin OnEditError, OnDeleteError event handlers) or programmatically (seting some state column to *edit* state) and preventing other users to work with that row while other user do)

for Optimistic lock when updating you can check whether update was succesful by checking RowsAffected property of TADOQuery - if RowsAffected = 0 then row was deleted and you should provide user with apropriate message. Next you must ensure that data in database is the same you started to work with - you can do it by adding some edit counter column which is updated each time update is made in row.

wbr, mo.

 

by: hetturkiPosted on 2003-06-16 at 05:08:03ID: 8731233

hi
put your application on you network ,the ADO will handles must of multiuser operation
I do it in ADO and its  work

best regards

 

by: kretzschmarPosted on 2003-06-16 at 06:00:42ID: 8731552

usual you have nothing else to do,
the database has to care concurrent sessions,
not the app itself

meikl ;-)

 

by: emadatPosted on 2003-06-16 at 10:15:51ID: 8733366

We can not say that the application will stay intact while the database will handle all the multuser tasking.!
The application have to consider some points

For example; if the application generates some sort of an ID -that should be unique- in a table; then what if two instances of the application generates the same ID; and then attept to inssert a record based on that ID at the same time?

Look at the scenario:
1- SELECT Max(OrderID) FROM Orders
2- do some processing
3- INSERT INTO Orders(OrderID, .........) Values(OrderID+1, ........)

Here you will have a problem at a point of time:
If one user starts at step #1 and before going into step #3 another user started step #1. the latest to perform step #3 will face an error!
A transaction will not simply solve this issue because if you start a transaction berofre that block of code and end it afterwards; then no one else will be able to insert any values until your transaction is over; which can take so long as "processing" may last for the duration of showing a form and accepting entry from a slow user.

This might seem to be a hypothetical problem but you will see it one place or the other.

Take a look at:
http://members.tripod.com/appdevissues/downloads/Developing%20Multi-User%20Microsoft%20Access%20Database%20Applications.pdf
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/odeopg/html/deovrmultiuserdatabasesolutionarchitectures.asp

 

by: morgantopPosted on 2003-06-16 at 10:45:28ID: 8733600

Hi all,
I think mocarts hit the "problem" i have. i also thoght ADO will handle mutiuser db "transparently", but if i change a record from within access i sometimes get an error saying "the record was changed" so i really need to trap this errors (?)

however if i delete a record in my app, MSAccess grid will imidiatly show "#DELETED" in his grid.
how to achive this behaviour in my app???

i thoght that using ctDynamic cursorType will solve my problems. but then i need to have cursorLocation = clUseServer. as soon as the table is active cursorType is automaticaly sets back to *ctStatic* (even if it was initialy ctKeyset).
this makes me a bit confused...

I use trasactions in every db operation i make, and all my PK are replication-id (GUID).

 

by: kretzschmarPosted on 2003-06-16 at 10:46:00ID: 8733610

>Look at the scenario:
>1- SELECT Max(OrderID) FROM Orders
>2- do some processing
>3- INSERT INTO Orders(OrderID, .........) Values(OrderID+1, ........)

(i would say, bad coding)

its not a good idea to do it in this way,
for this databases have sequences, autonumbers or generators

or you can use a secondary table for this

meikl ;-)

 

by: kretzschmarPosted on 2003-06-16 at 10:51:41ID: 8733660

>so i really need to trap this errors

you can use the onposterror-event to trap this error,
the dataset must be refreshed and changes must be discarded,
the user must begin for new

anyway, you cannot avoid such "errors" (this are no real errors)
in a multiuser-databases

even so be carefully with locks/or transactions,
because you can run into a deadlock

meikl ;-)

 

by: emadatPosted on 2003-06-16 at 10:58:03ID: 8733721

I did not say that this is a good coding.
It is indeed bad coding but; similar situations might arrise -not a replica of this nature- but similar.

I'm just trying to show that ADO will not simply do it on its own.
The developer have to code in a way that helps ADO to do handle it.

 

by: mocartsPosted on 2003-06-17 at 13:57:41ID: 8744248

GUID is not a good choice for primary key, better use integer as it will increase querying speed.
I'm not sure that you can use cursor location clUseServer for mdb (access) database (which is not a server, but simple db file)
according to ctDynamic explanatoin in msdn - this future depends on data provider you use - check future list of your data provider (i.e. OLE DB for Jet (recommended for mdb) or other)
alternatively you can ignore these events and check for deletion or modified record only when going to select, update or delete it.

wbr, mo.

 

by: morgantopPosted on 2003-06-19 at 13:04:41ID: 8761159

mocarts ,
> "GUID is not a good choice for primary key"...
well, i know, but this db is designed for replication (synconization) with other dbs. so it's the only working choice i have (but that is a nother story :) ).

basically i'm interested to know how the hell MSAccess grid imidiatly show "#DELETED" in his grid when i delete a record in my delphi app. how does it "sense" that my dataset was changed if Dynamic cursor are not supported in access? why doesnt delphi grid cant do so?

If i delete a record from access while my delphi grid is opend and try to edit a record i get:
"Row cannot be located for updating. Some Values have been change since it was last read" error.
Am i to asume this record was deleted? but i get this error when records are edited but other users... i'm confused.

how to achive this behaviour in my app???

i will begin testing tommoro and evaluate the answers gave to me here.
sorry about the delay with grading this q.
best regards.

 

by: CleanupPingPosted on 2003-09-08 at 21:29:05ID: 9315226

morgantop:
This old question needs to be finalized -- accept an answer, split points, or get a refund.  For information on your options, please click here-> http:/help/closing.jsp#1
EXPERTS:
Post your closing recommendations!  No comment means you don't care.

 

by: morgantopPosted on 2003-10-01 at 13:07:56ID: 9469405

I did not get an answer to this, so im deleting this q, if experts does not mind.
thanks for trying to help.

 

by: morgantopPosted on 2003-10-02 at 05:06:11ID: 9475984

>"Deleting the Question and NOT refunding points as morgantop did not report back with results."

Chmod, i have decided to delete this q AFTER i evaluated the answers i got here...
most of the answers here are actually off-topic.
so PAQing this question for the sake of just PAQing it would not be fair for other users who will seek an answer for this topic.
I would rather award points randomlly to one of the experts who tried to help here, than "punishing" me by deleting this q without a refund.

20120131-EE-VQP-002

3 Ways to Join

30-Day Free Trial

The Experts

98% positive feedback on 31,087 answers since March 2000. angeliii is a Microsoft Most Valuable Professional for his work with MS SQL Server & Develoment.

He has also proven his knowledge of Visual Basic Programming, PHP Scripting and Oracle Databases.

The Experts

97% positive feedback on 10,752 answers since July 2000. lrmoore has more than 18 years experience in the networking industry.

The six-time Mircosoft MVPs specialties include firewalls, virtual private networking, and network management.

Testimonials

"...and excellent source for support... Kind of like having your very own IT dept." Electriciansnet

Testimonials

"I was apprehensive at signing up at first. However... it has already made my life as an IT administrator much easier." JaCrews

Testimonials

"WOW! You guys have great, active, and knowledgeable people on here." moore50

Business Clients

Business Clients

In the Press

"If you’ve got a question... Experts Exchange can supply an answer.”

In the Press

"...an invaluable aid for both IT professionals and those who require tech support."

In the Press

"where IT professionals provide quick answers on just about any topic"

Business Account Plans

Loading Advertisement...